ItalyPaleAle / svelte-spa-router

Router for SPAs using Svelte 3
MIT License
1.53k stars 105 forks source link

Is there an alternative to the "Failed to fetch dynamically import problem" issue in Vite + Svelte spa environment? #307

Open Neptunium1129 opened 11 months ago

Neptunium1129 commented 11 months ago

Is there an alternative to the "Failed to fetch dynamically import problem" issue in Vite + Svelte environment?

image

example )

router.onError((error, to) => {
  if (error.message.includes('Failed to fetch dynamically imported module') || error.message.includes("Importing a module script failed")) {
    window.location = to.fullPath
  }
})

external communities is that it is better to handle it in the router.

ItalyPaleAle commented 9 months ago

I am not sure I understand, sorry. Could you share some more details on the error?