progNewbie
progNewbie

Reputation: 4832

Expected a JavaScript module script but the server responded with a MIME type of ""

I have a flutter app and now I tried compiling it to use wasm with flutter version 3.29.0.

When serving it on my apache webserver I get this error:

enter image description here

I use this command to build the app: flutter build web --wasm

My index.html script tag looks like this:

<script async>
    {{flutter_js}}
    {{flutter_build_config}}

    const searchParams = new URLSearchParams(window.location.search);
    const forceCanvaskit = searchParams.get('force_canvaskit') === 'true';
    const userConfig = forceCanvaskit ? {'renderer': 'canvaskit'} : {};

    const loading = document.getElementById('loading');
    const loadingTitle = document.getElementById('loadingTitle');
    loadingTitle.textContent = "Schritt 1/3";
    loading.textContent = "Lade Framework...";

    _flutter.loader.load({
      config: userConfig,
      serviceWorkerSettings: {
        serviceWorkerVersion: {{flutter_service_worker_version}},
      },
      onEntrypointLoaded: async function(engineInitializer) {
        loadingTitle.textContent = "Schritt 2/3";
        loading.textContent = "Initialisiere Engine...";
        const appRunner = await engineInitializer.initializeEngine();

        loadingTitle.textContent = "Schritt 3/3";
        loading.textContent = "Starte App...";
        await appRunner.runApp();
      }
    });
</script>

Is there something I am missing? What am I doing wrong? When using it with canvaskit it works perfectly.

Upvotes: 0

Views: 19

Answers (0)

Related Questions