mefechoel / svelte-navigator

Simple, accessible routing for Svelte
Other
502 stars 39 forks source link

How to reload/refresh current page #42

Closed ndzeux closed 2 years ago

ndzeux commented 3 years ago

I want reload my script, for example Home.svelte, in my case must reload Home.svelte I try navigate does not work How to do it ?

wassafr commented 2 years ago

That's because when you refresh the page, your browser sends a request with a URL like /xxxxx. This URL is processed by your web server but it leads to a 404 error as the only URL that does exist on your web server is /index.html.

In your dev/test environment you probably use sirv, in that cas juste add -s to the command line (for instance in your package.json), it will fallback all errors to index.html while keeping the correct URL. Then svelte-navigator will be abale to process the URL.

With a production web server like Apache or Nginx, you must to the same but the configuration is a bit more difficult but you will find a lot of example for react-router that can be applied to svelte-navigator