@@ -70,8 +70,6 @@ function resolvePackage(name: string) {
7070 return pathToFileURL ( require . resolve ( name ) ) . href
7171}
7272
73- export { vitePluginRscCore }
74-
7573export type RscPluginOptions = {
7674 /**
7775 * shorthand for configuring `environments.(name).build.rollupOptions.input.index`
@@ -144,6 +142,25 @@ export type RscPluginOptions = {
144142 }
145143}
146144
145+ /** @experimental */
146+ export function vitePluginRscMinimal ( ) : Plugin [ ] {
147+ return [
148+ {
149+ name : 'rsc:minimal' ,
150+ async config ( ) {
151+ await esModuleLexer . init
152+ } ,
153+ configResolved ( config_ ) {
154+ config = config_
155+ } ,
156+ configureServer ( server_ ) {
157+ server = server_
158+ } ,
159+ } ,
160+ ...vitePluginRscCore ( ) ,
161+ ]
162+ }
163+
147164export default function vitePluginRsc (
148165 rscPluginOptions : RscPluginOptions = { } ,
149166) : Plugin [ ] {
@@ -194,11 +211,10 @@ export default function vitePluginRsc(
194211 }
195212
196213 return [
214+ ...vitePluginRscMinimal ( ) ,
197215 {
198216 name : 'rsc' ,
199217 async config ( config , env ) {
200- await esModuleLexer . init
201-
202218 // crawl packages with "react" in "peerDependencies" to bundle react deps on server
203219 // see https://github.com/svitejs/vitefu/blob/d8d82fa121e3b2215ba437107093c77bde51b63b/src/index.js#L95-L101
204220 const result = await crawlFrameworkPkgs ( {
@@ -306,11 +322,7 @@ export default function vitePluginRsc(
306322 }
307323 } ,
308324 buildApp : rscPluginOptions . useBuildAppHook ? buildApp : undefined ,
309- configResolved ( config_ ) {
310- config = config_
311- } ,
312- configureServer ( server_ ) {
313- server = server_
325+ configureServer ( ) {
314326 ; ( globalThis as any ) . __viteRscDevServer = server
315327
316328 if ( rscPluginOptions . disableServerHandler ) return
@@ -849,7 +861,6 @@ globalThis.AsyncLocalStorage = __viteRscAyncHooks.AsyncLocalStorage;
849861 return ''
850862 } ,
851863 } ,
852- ...vitePluginRscCore ( ) ,
853864 ...vitePluginUseClient ( rscPluginOptions ) ,
854865 ...vitePluginUseServer ( rscPluginOptions ) ,
855866 ...vitePluginDefineEncryptionKey ( rscPluginOptions ) ,
0 commit comments