small-tech / sitekit

A template for creating your own Site.js + SvelteKit app.
Other
2 stars 0 forks source link

Server restart is required after every route creation #2

Open edgarasben opened 3 years ago

edgarasben commented 3 years ago

I noticed that after I create every new route e.g. "/routes/about.svelte" I need to restart a server (otherwise I get 404). I know this is not the case with a standalone SvelteKit.

aral commented 3 years ago

Hey @edgarasben,

Sadly, this is a fact of life for now but, hopefully, soon it will be possible to have the same experience you can have with Hugo (in that the generated content is updated every time you save). You still won’t have hot module reloading and I don’t see that changing anytime soon.

That said, if you want to test using hot module reloading, just open a different browser window at http://localhost:3000 and, there, you will see your SvelteKit client update in real time (but no Site.js-specific routes will be present as it’s just the SvelteKit client that’s being served there). You can have https://localhost and http://localhost:3000 open in two different browser tabs/windows to get the best of both worlds.

For hot reloading to work at https://localhost (i.e., the site that’s being served by Site.js), I’m waiting on this pull request making it into SvelteKit:

https://github.com/vitejs/vite/pull/1449

edgarasben commented 3 years ago

@aral thank you for taking time for an explanation. Sorry for the lack of expertise, but for sure it would be nice in the future if HMR would work fully on the localhost (Site.js + SvelteKit).

And by the way, how does it work in production, are there two servers running for Site.js and SvelteKit or is it somehow merged in to one? (sorry again for a possible silly question)