Skip to content

Commit 61b53b2

Browse files
committed
fix: force $app/* modules to be bundled
1 parent e142ab6 commit 61b53b2

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.changeset/flat-eggs-start.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/kit': patch
3+
---
4+
5+
fix: force `$app/*` modules to be bundled

packages/kit/src/exports/vite/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,11 @@ async function kit({ svelte_config }) {
297297
// that bundle later on from resolving the export conditions incorrectly
298298
// and for example include browser-only code in the server output
299299
// because they for example use esbuild.build with `platform: 'browser'`
300-
'esm-env'
300+
'esm-env',
301+
// This forces `$app/*` modules to be bundled, since they depend on
302+
// virtual modules like `__sveltekit/paths`
303+
// TODO use RegExp.escape once we drop Node <22
304+
new RegExp(runtime_directory.replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&'))
301305
]
302306
}
303307
};

0 commit comments

Comments
 (0)