File tree Expand file tree Collapse file tree 1 file changed +32
-2
lines changed
packages/qwik/src/optimizer/src/plugins Expand file tree Collapse file tree 1 file changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -875,8 +875,38 @@ export const manifest = ${JSON.stringify(manifest)};\n`;
875
875
// order by discovery time, so that related segments are more likely to group together
876
876
function manualChunks ( id : string , { getModuleInfo } : Rollup . ManualChunkMeta ) {
877
877
const module = getModuleInfo ( id ) ! ;
878
- const segment = module . meta . segment as SegmentAnalysis | undefined ;
879
- return segment ?. entry ;
878
+ const segment = module . meta . segment ;
879
+
880
+ const optimizer = getOptimizer ( ) ;
881
+ const path = optimizer . sys . path ;
882
+ const relativePath = path . relative ( optimizer . sys . cwd ( ) , id ) ;
883
+ const sanitizedPath = relativePath . replace ( / ^ \/ + / , '' ) . replace ( / \/ / g, '-' ) ;
884
+
885
+ if ( sanitizedPath . includes ( 'node_modules' ) ) {
886
+ if ( sanitizedPath . includes ( 'core.prod' ) ) {
887
+ return 'core' ;
888
+ }
889
+ return null ;
890
+ }
891
+
892
+ if ( sanitizedPath . includes ( 'preload-helper' ) ) {
893
+ return 'preload-helper' ;
894
+ }
895
+
896
+ if (
897
+ segment ||
898
+ sanitizedPath . endsWith ( '.qwik.mjs' ) ||
899
+ sanitizedPath . endsWith ( '.qwik.cjs' ) ||
900
+ sanitizedPath . endsWith ( '.tsx' ) ||
901
+ sanitizedPath . endsWith ( '.jsx' ) ||
902
+ sanitizedPath . endsWith ( '.mdx' ) ||
903
+ sanitizedPath . endsWith ( '.ts' ) ||
904
+ sanitizedPath . endsWith ( '.js' )
905
+ ) {
906
+ return sanitizedPath ;
907
+ }
908
+
909
+ return null ;
880
910
}
881
911
882
912
return {
You can’t perform that action at this time.
0 commit comments