Skip to content

Commit 9608c2c

Browse files
fix: disabled topLevelVar
this will cause isServer not to be transpiled to `var` and thus rspack can properly DCE
1 parent d406d1a commit 9608c2c

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎.changeset/slow-seahorses-grab.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tanstack/router-core': patch
3+
---
4+
5+
prevent isServer exports from being transformed to top-level vars so rspack can dead-code eliminate them

‎packages/router-core/vite.config.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ import type { ViteUserConfig } from 'vitest/config'
77

88
const config = defineConfig({
99
plugins: [minifyScriptPlugin()] as ViteUserConfig['plugins'],
10+
build: {
11+
rolldownOptions: {
12+
output: {
13+
topLevelVar: false
14+
}
15+
}
16+
},
1017
test: {
1118
name: packageJson.name,
1219
dir: './tests',

0 commit comments

Comments
 (0)