@@ -88,36 +88,31 @@ export default defineConfig({
8888 return "assets/shared/[name].[hash][extname]" ;
8989 } ,
9090
91- // Simplified manual chunks strategy with forced common chunk
9291 manualChunks : ( id ) => {
93- // React, React-DOM, and Base UI in a separate chunk (Base UI depends on React)
94- if (
95- id . includes ( "node_modules" ) &&
96- ( id . includes ( "react" ) ||
97- id . includes ( "react-dom" ) ||
98- id . includes ( "@base-ui-components" ) )
99- ) {
100- return "react-vendor" ;
101- }
92+ if ( ! id . includes ( "node_modules" ) ) {
93+ const absoluteId = resolve ( id ) ;
94+ const absoluteSrcScreensDir = resolve ( __dirname , "src/screens" ) ;
10295
103- // All other node_modules dependencies go into vendor chunk
104- if ( id . includes ( "node_modules" ) ) {
105- return "vendor" ;
96+ if (
97+ absoluteId . includes ( resolve ( __dirname , "src/" ) ) &&
98+ ! absoluteId . startsWith ( absoluteSrcScreensDir + "/" )
99+ ) {
100+ return "common" ;
101+ }
102+ return undefined ;
106103 }
107104
108- // Everything in src/ but NOT in src/screens/ goes to common
109- const absoluteId = resolve ( id ) ;
110- const absoluteSrcScreensDir = resolve ( __dirname , "src/screens" ) ;
111-
105+ // React core packages (no external dependencies) go to react-vendor
112106 if (
113- absoluteId . includes ( resolve ( __dirname , "src/" ) ) &&
114- ! absoluteId . startsWith ( absoluteSrcScreensDir + "/" )
107+ id . includes ( "/node_modules/react/" ) ||
108+ id . includes ( "/node_modules/react-dom/" ) ||
109+ id . includes ( "/node_modules/scheduler/" ) // Keep React's internals together
115110 ) {
116- return "common " ;
111+ return "react-vendor " ;
117112 }
118113
119- // For screen-specific code or other cases, let Rollup decide
120- return undefined ;
114+ // All other node_modules go to vendor
115+ return "vendor" ;
121116 } ,
122117 } ,
123118 } ,
0 commit comments