Skip to content

Commit 9189803

Browse files
serpentbladeclaude
andcommitted
chore: bump react/vue/svelte consumers to vite 8 (+ fix 2 regressions)
Moves the three plugin-gated consumers from vite 5/6 → 8.1.0 (Rollup → Rolldown), with framework plugins bumped to their vite-8 majors: plugin-react ^4→^6, plugin-vue ^5→^6, vite-plugin-svelte ^5→^7. Two real Vite-8 regressions surfaced and fixed: 1. React null-dispatcher crash (react-vite). plugin-react 6 + Rolldown no longer auto-dedupes React, so a workspace React copy got double-bundled → `Cannot read properties of null (reading 'useRef')` at first render, blanking the app. Added explicit resolve.dedupe (mirrors the existing vite.config.swc.ts which already documented this exact failure). 2. e2e IPv6/IPv4 desync (all three). Vite 8 binds `vite preview` to IPv6 [::1] by default; Playwright's port-probe hits IPv4 127.0.0.1 → readiness hang. Pinned preview host + webServer.url + baseURL to explicit 127.0.0.1. Verified per consumer: build + typecheck + full e2e green — react 23/23, vue 10/10, svelte 17/17. solid/lit (already on 8.1, no plugin gate) unchanged and re-verified 10/10 + 14/14. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KSYH6VBAJwa7nYy4AksuNH
1 parent a73bb30 commit 9189803

8 files changed

Lines changed: 83 additions & 58 deletions

File tree

examples/consumers/react-vite/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"build": "vite build",
1010
"build:swc": "vite build --config vite.config.swc.ts",
1111
"build:preact": "vite build --config vite.config.preact.ts",
12-
"preview": "vite preview --port 4174",
12+
"preview": "vite preview --port 4174 --host 127.0.0.1",
1313
"typecheck": "tsc --noEmit",
1414
"test:e2e": "playwright test",
1515
"test:e2e:swc": "VITE_USE_SWC=1 playwright test",
@@ -33,13 +33,13 @@
3333
"@types/node": "^20",
3434
"@types/react": "^19.2.14",
3535
"@types/react-dom": "^19.2.3",
36-
"@vitejs/plugin-react": "^4",
36+
"@vitejs/plugin-react": "^6",
3737
"@vitejs/plugin-react-swc": "^4",
3838
"eslint": "^9",
3939
"eslint-plugin-react-hooks": "^5",
4040
"playwright": "^1",
4141
"source-map-js": "^1.2.1",
4242
"typescript": "^5.6",
43-
"vite": "^5"
43+
"vite": "^8"
4444
}
4545
}

examples/consumers/react-vite/playwright.config.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,15 @@ export default defineConfig({
2727
testDir: './tests/e2e',
2828
timeout: 30_000,
2929
use: {
30-
baseURL: 'http://localhost:4174',
30+
baseURL: 'http://127.0.0.1:4174',
3131
trace: 'on-first-retry',
3232
},
3333
webServer: {
3434
command: buildCommand,
35-
port: 4174,
35+
// Vite 8 (Rolldown) binds preview to IPv6 `[::1]` by default; pin the
36+
// server + readiness probe + baseURL to explicit IPv4 127.0.0.1 so the
37+
// ambiguous `localhost` (IPv6-first on Node 18+/macOS) can't desync them.
38+
url: 'http://127.0.0.1:4174',
3639
reuseExistingServer: !process.env.CI,
3740
timeout: 120_000,
3841
},

examples/consumers/react-vite/vite.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ export default defineConfig({
2020
Rozie({ target: 'react' }),
2121
react(),
2222
],
23+
// @vitejs/plugin-react 6 + Vite 8 (Rolldown) no longer auto-dedupes React the
24+
// way the Babel plugin did under Vite ≤7. In a pnpm workspace a runtime
25+
// package can drag in its own React copy, so both get bundled and hooks read
26+
// a null `ReactCurrentDispatcher` → `Cannot read properties of null (reading
27+
// 'useRef')` at first render. Force every `import 'react'` to the consumer's
28+
// single copy. Mirrors vite.config.swc.ts.
29+
resolve: {
30+
dedupe: ['react', 'react-dom'],
31+
},
2332
build: {
2433
sourcemap: true, // DX-01 requirement — stack traces resolve to .rozie
2534
},

examples/consumers/svelte-vite/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
},
2525
"devDependencies": {
2626
"@playwright/test": "^1",
27-
"@sveltejs/vite-plugin-svelte": "^5.1.1",
27+
"@sveltejs/vite-plugin-svelte": "^7",
2828
"@tsconfig/svelte": "^5",
2929
"playwright": "^1",
3030
"svelte-check": "^4",
3131
"typescript": "^5.6",
32-
"vite": "^6"
32+
"vite": "^8"
3333
}
3434
}

examples/consumers/svelte-vite/playwright.config.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ export default defineConfig({
1313
testDir: './tests/e2e',
1414
timeout: 30_000,
1515
use: {
16-
baseURL: 'http://localhost:4175',
16+
baseURL: 'http://127.0.0.1:4175',
1717
trace: 'on-first-retry',
1818
},
19+
// Vite 8 (Rolldown) binds preview to IPv6 `[::1]` by default; pin server +
20+
// probe + baseURL to explicit IPv4 so ambiguous `localhost` can't desync them.
1921
webServer: {
20-
command: 'pnpm build && pnpm preview --port 4175 --strictPort',
21-
port: 4175,
22+
command: 'pnpm build && pnpm preview --port 4175 --strictPort --host 127.0.0.1',
23+
url: 'http://127.0.0.1:4175',
2224
reuseExistingServer: !process.env.CI,
2325
timeout: 120_000,
2426
},

examples/consumers/vue-vite/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
},
2525
"devDependencies": {
2626
"@playwright/test": "^1",
27-
"@vitejs/plugin-vue": "^5",
27+
"@vitejs/plugin-vue": "^6",
2828
"playwright": "^1",
2929
"source-map-js": "^1.2.1",
3030
"typescript": "^5.6",
31-
"vite": "^5",
31+
"vite": "^8",
3232
"vue-tsc": "^2"
3333
}
3434
}

examples/consumers/vue-vite/playwright.config.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@ export default defineConfig({
44
testDir: './tests/e2e',
55
timeout: 30_000,
66
use: {
7-
baseURL: 'http://localhost:4173',
7+
baseURL: 'http://127.0.0.1:4173',
88
trace: 'on-first-retry',
99
},
1010
// `pnpm build && pnpm preview --port 4173`:
1111
// - `vite build` produces dist/ (production source maps verified by DX-01 e2e)
12-
// - `vite preview` serves dist/ at localhost:4173
12+
// - `vite preview` serves dist/ at 127.0.0.1:4173
1313
// - reuseExistingServer in dev avoids re-build per test run
14+
// Vite 8 (Rolldown) binds preview to IPv6 `[::1]` by default; pin server +
15+
// probe + baseURL to explicit IPv4 so ambiguous `localhost` can't desync them.
1416
webServer: {
15-
command: 'pnpm build && pnpm preview --port 4173 --strictPort',
16-
port: 4173,
17+
command: 'pnpm build && pnpm preview --port 4173 --strictPort --host 127.0.0.1',
18+
url: 'http://127.0.0.1:4173',
1719
reuseExistingServer: !process.env.CI,
1820
timeout: 120_000,
1921
},

pnpm-lock.yaml

Lines changed: 51 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)