-
-
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
force Vite to bundle component libraries in SSR #1148
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d6b6edc
force Vite to bundle component libraries in SSR - fixes #904
Rich-Harris 6158086
get things working
Rich-Harris dae6852
lockfile, again
Rich-Harris ef60d0f
update docs
Rich-Harris 3c5083b
Update documentation/faq/70-packages.md
5bef860
remove ssr config from svelte.config.cjs
Rich-Harris e1049ed
Merge branch 'gh-904' of github.com:sveltejs/kit into gh-904
Rich-Harris 5cecd8a
changeset
Rich-Harris File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@sveltejs/kit': patch | ||
--- | ||
|
||
Force Vite to bundle Svelte component libraries in SSR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'create-svelte': patch | ||
--- | ||
|
||
Remove obsolete vite.ssr config from template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can we add back this description except for the part after "You should also add...". It's pretty confusing about what goes where and why and I think the extra explanation as to what's going on is helpful
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.
It's out of date (though this did remind me to remove the
vite.ssr
block from svelte.config.cjs, so thanks). We don't ask Vite to bundle dependencies for serverless deployment; it bundles the stuff it thinks need to be bundled (based on its heuristic, the heuristic implemented in this PR, and the user'snoExternal
config), and adapters bundle everything else if they deem it necessary.Technically speaking it was never correct; SvelteKit isn't asking for special treatment of
dependencies
, the project template was. Now that thevite.ssr
config is removed from the template, swapping stuff betweendependencies
anddevDependencies
will make no difference, and nor should it — that was always a weird hack we embraced out of necessity.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.
Yeah, you're right that it was a bit imprecise about SvelteKit vs template
I didn't realize
vite.ssr
could be removed from the templates. I thought that was still needed as a trick @GrygrFlzr had introduced for bundling for deployment to serverless environments. I didn't think it could be removed without updating the adapters as described in #1016. If I'm wrong, maybe that issue can be closed nowAnyway, I'm happy it's gone. I just hope we didn't make it hard to use the adapters