ItalyPaleAle / svelte-spa-router

Router for SPAs using Svelte 3
MIT License
1.56k stars 106 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 1 year ago

Neptunium1129 commented 1 year 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 11 months ago

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