Sometimes, I get a really weird thing: I get an error 500 in sveltekit like:
with, in the browser, an error:
The next HMR update will cause the page to reload
SyntaxError: import not found: default
and I often get a list of modules that fail to import like Uncaught (in promise) TypeError: error loading dynamically imported module: http://localhost:51730/node_modules/@sveltejs/kit/src/runtime/client/entry.js
(this error vanishes on reload). For sure, this is not because of my code (checkout other commit still produce this error while they used to work just fine, cloning into another directory and restarting also fails)… But sometimes, it finishes to vanish with no apparent reasons (cache cleaning seems to help but is not enough), but it is very annoying to clean all npm cache, and I still don’t have a really deterministic way to make it work always… any idea what I get and how to fix this reliably?
If it helps, here is the html code of the page the browser receives:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="./favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body data-sveltekit-preload-data="hover" data-theme="skeleton">
<div style="display: contents">
<script>
{
__sveltekit_dev = {
base: new URL(".", location).pathname.slice(0, -1),
env: {}
};
const element = document.currentScript.parentElement;
Promise.all([
import("/node_modules/@sveltejs/kit/src/runtime/client/entry.js"),
import("/@fs/home/leo/Documents/Informatique/Programmation/Projects/2024_03_sveltekit/.svelte-kit/generated/client/app.js")
]).then(([kit, app]) => {
kit.start(app, element);
});
}
</script>
</div>
</body>
</html>