Skip to content

Commit d553fb3

Browse files
committed
wip
1 parent 11d8903 commit d553fb3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/plugin-rsc/src/plugin.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,18 @@ export default function vitePluginRsc(
265265
...result.ssr.noExternal.sort(),
266266
]
267267

268+
// vendor and optimize use-sync-external-store since
269+
// this is a common transitive cjs dep, which tends to cause a cryptic error.
270+
const vendorDeps = [
271+
`${PKG_NAME}/vendor/use-sync-external-store`,
272+
`${PKG_NAME}/vendor/use-sync-external-store/with-selector`,
273+
`${PKG_NAME}/vendor/use-sync-external-store/with-selector.js`,
274+
`${PKG_NAME}/vendor/use-sync-external-store/shim`,
275+
`${PKG_NAME}/vendor/use-sync-external-store/shim/index.js`,
276+
`${PKG_NAME}/vendor/use-sync-external-store/shim/with-selector`,
277+
`${PKG_NAME}/vendor/use-sync-external-store/shim/with-selector.js`,
278+
]
279+
268280
return {
269281
appType: 'custom',
270282
define: {
@@ -311,6 +323,7 @@ export default function vitePluginRsc(
311323
'react/jsx-dev-runtime',
312324
'react-dom/server.edge',
313325
`${REACT_SERVER_DOM_NAME}/client.edge`,
326+
...vendorDeps,
314327
],
315328
exclude: [PKG_NAME],
316329
},

0 commit comments

Comments
 (0)