Skip to content
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

[fix] ensure export conditions are resolve through Vite #8092

Merged
merged 1 commit into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/lucky-apples-breathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

[fix] ensure export conditions are resolve through Vite
11 changes: 10 additions & 1 deletion packages/kit/src/exports/vite/build/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,16 @@ export function get_build_setup_config({ config, ssr }) {
exclude: ['@sveltejs/kit']
},
ssr: {
noExternal: ['@sveltejs/kit']
noExternal: [
// TODO document why this is necessary
'@sveltejs/kit',
// This ensures that esm-env is inlined into the server output with the
// export conditions resolved correctly through Vite. This prevents adapters
// that bundle later on to resolve the export conditions incorrectly
// and for example include browser-only code in the server output
// because they for example use esbuild.build with `platform: 'browser'`
'esm-env'
]
},
worker: {
rollupOptions: {
Expand Down