@@ -3,8 +3,9 @@ import { fileURLToPath } from 'node:url';
33import { pluginReact } from '@rsbuild/plugin-react' ;
44import { pluginSass } from '@rsbuild/plugin-sass' ;
55import { pluginSvgr } from '@rsbuild/plugin-svgr' ;
6- import { defineConfig } from '@rslib/core' ;
6+ import { defineConfig , type RsbuildPlugin } from '@rslib/core' ;
77import { pluginPublint } from 'rsbuild-plugin-publint' ;
8+ import { exportStarOptimizerTransform } from './src/node/theme/exportStarOptimizerTransform' ;
89
910const COMMON_EXTERNALS = [
1011 'virtual-routes' ,
@@ -39,6 +40,7 @@ export default defineConfig({
3940
4041 // TODO: should add entry by new URL parser in Rspack module graph
4142 'node/mdx/loader' : './src/node/mdx/loader.ts' ,
43+ 'node/theme/loader' : './src/node/theme/loader.ts' ,
4244 'node/ssg/renderPageWorker' : './src/node/ssg/renderPageWorker.ts' ,
4345 } ,
4446 } ,
@@ -116,6 +118,17 @@ export default defineConfig({
116118 pluginReact ( ) ,
117119 pluginSvgr ( { svgrOptions : { exportType : 'default' } } ) ,
118120 pluginSass ( ) ,
121+ {
122+ name : 'export_star_optimizer' ,
123+ setup ( api ) {
124+ api . transform (
125+ { test : / s r c \/ t h e m e \/ i n d e x \. t s / } ,
126+ ( { code, resourcePath } ) => {
127+ return exportStarOptimizerTransform ( code , resourcePath ) ;
128+ } ,
129+ ) ;
130+ } ,
131+ } satisfies RsbuildPlugin ,
119132 ] ,
120133 source : {
121134 define : {
0 commit comments