Skip to content

Commit

Permalink
[fix] add $app and $env to optimizeDeps.exclude to allow prebundling …
Browse files Browse the repository at this point in the history
…for libraries using them (#7933)
  • Loading branch information
dominikg committed Dec 5, 2022
1 parent b9406a0 commit c1b4f81
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/healthy-walls-move.md
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

add $app and $env to optimizeDeps.exclude so that libraries using these work correctly when prebundled
8 changes: 7 additions & 1 deletion packages/kit/src/exports/vite/index.js
Expand Up @@ -274,7 +274,13 @@ function kit() {
external: ['@sveltejs/kit']
},
optimizeDeps: {
exclude: ['@sveltejs/kit']
exclude: [
'@sveltejs/kit',
// exclude kit features so that libraries using them work even when they are prebundled
// this does not affect app code, just handling of imported libraries that use $app or $env
'$app',
'$env'
]
}
};

Expand Down

0 comments on commit c1b4f81

Please sign in to comment.