Useful or not, from you.
svelte onMount Error: Function called outside component initialization

I have read sveltejs/sapper#592 but all of the solutions are not working. Is there any solution to fix this issue?

    import { onMount } from 'svelte';

    let myVar = [];

    onMount(async () => {
        myVar = await {someAPICall};
That's a useful answer
Without any help

Sorry, I have found the problem in my webpack.config.js. '.mjs' must be included in the extensions field.

resolve: {
    extensions: ['.mjs', '.js', '.svelte', '.json']
module: {
         test: /\.mjs$/,
         include: /node_modules/,
         type: 'javascript/auto',
         loader: 'babel-loader