Skip to content

Commit 66bd007

Browse files
committed
feat(rsc): add frameworkPackages options to control server external
1 parent 2a7ff5c commit 66bd007

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

packages/plugin-rsc/src/plugin.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ export type RscPluginOptions = {
110110

111111
/** Escape hatch for Waku's `allowServer` */
112112
keepUseCientProxy?: boolean
113+
114+
/**
115+
* The packages which depends on `frameworkPackages` will be added to `noExternal`
116+
* @default ["react"]
117+
*/
118+
frameworkPackages?: string[]
113119
}
114120

115121
export default function vitePluginRsc(
@@ -128,10 +134,14 @@ export default function vitePluginRsc(
128134
isBuild: env.command === 'build',
129135
isFrameworkPkgByJson(pkgJson) {
130136
if ([PKG_NAME, 'react-dom'].includes(pkgJson.name)) {
131-
return
137+
return false
138+
}
139+
const deps = {
140+
...pkgJson['dependencies'],
141+
...pkgJson['peerDependencies'],
132142
}
133-
const deps = pkgJson['peerDependencies']
134-
return deps && 'react' in deps
143+
Object.keys(deps)
144+
return 'react' in deps
135145
},
136146
})
137147
const noExternal = [

0 commit comments

Comments
 (0)