-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vite preview
serves .svelte-kit, not build, leading to incorrect behaviour with adapter-static
#10734
Comments
It's intended that |
Thanks! From my side I think it would be better that npm run preview actually gives me an accurate preview... I figured this out after running into many issues with differences between local preview (that I incorrectly assumed to be the static build), would definitely be helpful. |
For most of the adapters, there's not really a simple way to run the actual adapted build output locally, as it depends on runtimes present on whatever that cloud provider is. For the Node adapter, you can just directly run the build output with But making it clearer what |
Which version of Vite are you using? Sveltekit uses Vite 4.4.2 by default. When I tried using 4.5.1 or newer, I also got some strange behavior, like no CSS until I went to another page and back, or when using 5.0.2, the page would not even load on prod, because of a different base path. |
Note: If npm run build hasn't been run, it will still serve from .svelte-kit due to an adapter-static quirk. See the following link for more information. sveltejs/kit#10734
Note: If npm run build hasn't been run, it will still serve from .svelte-kit due to an adapter-static quirk. See the following link for more information. sveltejs/kit#10734
Note: If npm run build hasn't been run, it will still serve from .svelte-kit due to an adapter-static quirk. See the following link for more information. sveltejs/kit#10734
Describe the bug
The docs explain that
npm run preview
should be used afternpm run build
, however, at least in the case of adapter-static the behaviour is different – the generated things in .svelte-kit are served instead leading to very different behaviour, for example with routes and error handling (e.g. in a static build any missing route goes to the fallback page, no matter if there's a matcher or not).There is a partial workaround by using the
serve
package and replacingvite preview
withserve build
, but that is only a partial solution as it doesn't support base paths, has a different HTTPS setup, and the like.Potentially related to #3535
Logs
No response
System Info
Severity
annoyance
Additional Information
The last thing
npm run build
logs is:which is not really true given these limitations.
The text was updated successfully, but these errors were encountered: