File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -489,6 +489,25 @@ async function createServerBundle(monorepoRoot: string) {
489
489
injectMiddlewareGeolocation ( outputPath , packagePath ) ;
490
490
removeCachedPages ( outputPath , packagePath ) ;
491
491
addCacheHandler ( outputPath ) ;
492
+
493
+ if ( options . minify ) {
494
+ removeNodeModule ( path . join ( outputPath , "node_modules" ) , [
495
+ "@esbuild" ,
496
+ "prisma/libquery_engine-darwin-arm64.dylib.node" ,
497
+ "@swc/core-darwin-arm64" ,
498
+ "@swc/core" ,
499
+ "better-sqlite3" ,
500
+ "esbuild" ,
501
+ "webpack" ,
502
+ "uglify-js" ,
503
+ // "react", // TODO: remove react/react-dom when nextjs updates its precompile versions
504
+ // "react-dom",
505
+ "@webassemblyjs" ,
506
+ "uglify-js" ,
507
+ "sass" ,
508
+ "caniuse-lite" ,
509
+ ] ) ;
510
+ }
492
511
}
493
512
494
513
function addMonorepoEntrypoint ( outputPath : string , packagePath : string ) {
@@ -743,3 +762,13 @@ function compareSemver(v1: string, v2: string): number {
743
762
if ( minor1 !== minor2 ) return minor1 - minor2 ;
744
763
return patch1 - patch2 ;
745
764
}
765
+
766
+ function removeNodeModule ( nodeModulesPath : string , modules : string [ ] ) {
767
+ console . log ( "removing: " , modules ) ;
768
+ for ( const module of modules ) {
769
+ fs . rmSync ( path . join ( nodeModulesPath , module ) , {
770
+ force : true ,
771
+ recursive : true ,
772
+ } ) ;
773
+ }
774
+ }
You can’t perform that action at this time.
0 commit comments