File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ export type RscPluginOptions = {
112112 keepUseCientProxy ?: boolean
113113
114114 /**
115- * The packages which depends on `frameworkPackages` will be added to `noExternal`
115+ * The packages which depend on `frameworkPackages` will be automatically added to `noExternal`.
116116 * @default ["react"]
117117 */
118118 frameworkPackages ?: string [ ]
@@ -129,19 +129,22 @@ export default function vitePluginRsc(
129129
130130 // crawl packages with "react" in "peerDependencies" to bundle react deps on server
131131 // see https://github.com/svitejs/vitefu/blob/d8d82fa121e3b2215ba437107093c77bde51b63b/src/index.js#L95-L101
132+ const frameworkPackages = rscPluginOptions . frameworkPackages || [
133+ 'react' ,
134+ ]
132135 const result = await crawlFrameworkPkgs ( {
133136 root : process . cwd ( ) ,
134137 isBuild : env . command === 'build' ,
135138 isFrameworkPkgByJson ( pkgJson ) {
139+ // these are added by default
136140 if ( [ PKG_NAME , 'react-dom' ] . includes ( pkgJson . name ) ) {
137141 return false
138142 }
139143 const deps = {
140144 ...pkgJson [ 'dependencies' ] ,
141145 ...pkgJson [ 'peerDependencies' ] ,
142146 }
143- Object . keys ( deps )
144- return 'react' in deps
147+ return frameworkPackages . some ( ( name ) => name in deps )
145148 } ,
146149 } )
147150 const noExternal = [
You can’t perform that action at this time.
0 commit comments