Skip to content

Commit

Permalink
[fix] ensure export conditions are resolve through Vite
Browse files Browse the repository at this point in the history
Fixes #8082
  • Loading branch information
dummdidumm committed Dec 12, 2022
1 parent 53300c4 commit d3a3f4a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
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

0 comments on commit d3a3f4a

Please sign in to comment.