-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Clarify the use of svelte-kit preview and adapters #1613
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
Conversation
documentation/docs/13-cli.md
Outdated
@@ -27,7 +27,7 @@ Builds a production version of your app, and runs your adapter if you have one s | |||
|
|||
### svelte-kit preview | |||
|
|||
After you've built your app with `svelte-kit build`, you can start the production version (irrespective of any adapter that has been applied) locally with `svelte-kit preview`. This is intended for testing the production build locally, **not for serving your app**, for which you should always use an adapter. | |||
After you've built your app with `svelte-kit build`, you can start the production version (irrespective of any adapter that has been applied) locally with `svelte-kit preview`. This is intended for testing the production build locally, **not for serving your app**, for which you should always use an adapter. The way your app will be served is dependent on the adapter used, see the documentation of your chosen adapter for specific instructions on how to run your app. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the new sentence seems out of place to me because running your app in production with the adapter is unrelated to svelte-kit preview
. it seems like it might belong in the svelte-kit build
section or something instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I placed it here because the preceding sentence mentions it is not for serving your app leaving several users wonder what the correct command is for serving the app.
Ideally a comment like this (I can have another look later) would be somehow integrated in the sections about adapters
themselves.
I feel the documentation is lacking here as this is a question that comes back every other day on the Discord in some form or another, but clearly some more discussion can be had here.
I would propose to move the wording indeed to svelte-kit build
with something along the lines of
After building you can run your app, see the chosen adapter for specific instructions on how to do this.
In preview remove the new lines, but add a link to the adapter section.
And in the adapter section another note that you should check the documentation of the adapter for serving instructions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the following line in the preview
docs still needs to be more clear:
-This is intended for testing the production build locally, **not for serving your app**, for which you should always use an adapter
+This is intended for testing the production build locally, **not for serving your app in the adapter target environment locally** (for locally testing a prod build with the adapter output see the adapter docs).
Or something of the sort. The distinctions I see that need to be made are:
- dev:
svelte-kit dev
- build prod (used for all subsequent steps):
svelte-kit build
- test prod build locally without adapter environment:
svelte-kit preview
- test prod build locally with adapter environment: see adapter docs
- deploy prod build to adapter environment: see adapter docs
with steps 3 and 4 being the confusing pieces. 3 relates to preview
so should explicitly mention not running in the adapters env, even though you just built using the adapter. 4 relates to build
so should be there.
The docs don't make these 5 steps clear in a concise manner. You have to read a lot of documentation to gather the information on these 5 steps.
Co-authored-by: Ben McCann <[email protected]>
Co-authored-by: Ben McCann <[email protected]>
This PR simple adds an extra comment to
svelte-kit preview
noting that serving the final app is dependent on the adapter used and refers the developers to the documentation of the adapter to learn how to actually serve their app in production.Reason for this change is that is a recurring question, the documentation tells that you should not use the preview command but does little in explaining where to get the information on how to do it.