Failed to fetch dynamically imported module
See original GitHub issueDescribe 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
fallbacktoindex.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:
- Created 2 years ago
- Comments:10 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

To follow up on how I solved my problem, in case it helps…
I removed…
…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.
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.