question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to fetch dynamically imported module

See original GitHub issue

Describe the bug

Hi, we are using SvelteKit on production for a while now and recently added Sentry to monitor errors.

Some of our settings:

  • SSR: off
  • Pre-render: disabled
  • adapter: static
  • hosting: netlify
  • it’s a SPA (we have fallback to index.html)

The error log looks something like this: Failed to fetch dynamically imported module: https://<our_page.com>/_app/pages/index.svelte-91a57275.js

And the odd thing is that it does not happen on any particular route and not always, but often enough.

Reproduction

It is not reproducible on development and it happens randomly. Probably something to do with SPA?

Logs

TypeError: 'text/html' is not a valid JavaScript MIME type.
Failed to fetch dynamically imported module: https://<our_page.com>/_app/pages/index.svelte-91a57275.js

System Info

System:
    OS: macOS 12.0.1
    CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
    Memory: 31.21 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.2 - ~/.nvm/versions/node/v14.17.2/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 7.23.0 - ~/.nvm/versions/node/v14.17.2/bin/npm
    Watchman: 2022.01.03.00 - /usr/local/bin/watchman
  Browsers:
    Brave Browser: 98.1.35.101
    Chrome: 98.0.4758.102
    Firefox: 97.0
    Safari: 15.1
  npmPackages:
    @sveltejs/adapter-static: ^1.0.0-next.28 => 1.0.0-next.28
    @sveltejs/kit: ^1.0.0-next.266 => 1.0.0-next.266
    svelte: ^3.45.0 => 3.45.0

Severity

serious, but I can work around it

Additional Information

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
goynangcommented, Apr 25, 2022

To follow up on how I solved my problem, in case it helps…

I removed…

[functions]
    node_bundler = "esbuild"

…which I had added a while back to resolve some other problem building on Netlify. With that gone everything builds fine for me again now (including with latest version of kit). Until next time I guess.

1reaction
el-schneidercommented, Apr 25, 2022

I’m also suddenly getting very similar errors and while my build is not failing the deployed website isn’t working.

Edit: everything is working fine locally. Going back to previously deployed (and working) commits is however not working anymore. I’m using the netlify-adapter btw. Looks to me like maybe netlify has changed something.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to fetch dynamically imported module" on Vue/Vite ...
We have a vanilla Vue/Vite setup and I'm receiving TypeError: Failed to fetch dynamically imported module on sentry logs.
Read more >
Failed to fetch dynamically imported module #1144 - GitHub
This error happens when you have an error in your code which is causing a module import to fail. There were no breaking...
Read more >
failed to fetch dynamically imported module react - You.com
One attempt to fix this issue, try to catch the error and force a reload to refetch the resource, but make sure to...
Read more >
Blazor Webassembly - "Failed to fetch dynamically imported ...
Works if I disable Hot Reload. I haven't tested Blazor Server or Blazor Webassembly Hosted, but can if that would help. On a...
Read more >
Error: Failed to fetch dynamically Dashboard imported module
Error: Failed to fetch dynamically Dashboard imported module · Uninstall TBM · Go to installation folder and delete everything except: \resources\ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found