Skip to content

Commit 4d51c70

Browse files
committed
test(rsc): fix rolldown-vite
1 parent c8ecad0 commit 4d51c70

File tree

3 files changed

+135
-409
lines changed

3 files changed

+135
-409
lines changed

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@
7272
]
7373
},
7474
"pnpm": {
75+
"overrides": {
76+
"vite": "catalog:rolldown-vite"
77+
},
7578
"packageExtensions": {
7679
"generouted": {
7780
"peerDependencies": {

packages/plugin-rsc/examples/react-router/cf/vite.config.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,6 @@ export default defineConfig({
3636
},
3737
],
3838
}),
39-
{
40-
name: 'react-router-fixup',
41-
transform(code) {
42-
if (code.includes(`import { AsyncLocalStorage } from 'async_hooks';`)) {
43-
code = code.replaceAll('async_hooks', 'node:async_hooks')
44-
code = code.replaceAll(
45-
`global.___reactRouterServerStorage___`,
46-
`globalThis.___reactRouterServerStorage___`,
47-
)
48-
return code
49-
}
50-
},
51-
},
5239
],
5340
environments: {
5441
client: {
@@ -61,12 +48,24 @@ export default defineConfig({
6148
include: ['react-router > cookie', 'react-router > set-cookie-parser'],
6249
exclude: ['react-router'],
6350
},
51+
build: {
52+
rollupOptions: {
53+
// @ts-ignore rolldown only
54+
platform: 'neutral',
55+
},
56+
},
6457
},
6558
rsc: {
6659
optimizeDeps: {
6760
include: ['react-router > cookie', 'react-router > set-cookie-parser'],
6861
exclude: ['react-router'],
6962
},
63+
build: {
64+
rollupOptions: {
65+
// @ts-ignore rolldown only
66+
platform: 'neutral',
67+
},
68+
},
7069
},
7170
},
7271
})

0 commit comments

Comments
 (0)