1- import path from "node:path" ;
2- import fs from "node:fs" ;
3- import webpack from "webpack" ;
4- import { build } from "vite" ;
51import esbuild from "esbuild" ;
2+ import fs from "node:fs" ;
3+ import path from "node:path" ;
64import { fileURLToPath } from "node:url" ;
5+ import { build } from "vite" ;
6+ import webpack from "webpack" ;
77
88const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
99const APPLICATIONS_DIR = path . join ( __dirname , ".." , "applications" ) ;
@@ -23,15 +23,21 @@ export class BundlerSizeBenchmarker {
2323 entry : path . resolve ( APPLICATIONS_DIR , this . application ) ,
2424 target : "web" ,
2525 output : { path : DIST_DIR , filename : path . basename ( outfile ) , library : "dist" } ,
26- optimization : { minimize : true , splitChunks : false , runtimeChunk : false , sideEffects : true , usedExports : true } ,
26+ optimization : {
27+ minimize : true ,
28+ splitChunks : false ,
29+ runtimeChunk : false ,
30+ sideEffects : true ,
31+ usedExports : true ,
32+ } ,
2733 stats : "none" ,
2834 } ,
2935 ( err , stats ) => {
3036 if ( err ) return reject ( err ) ;
3137 if ( stats ?. hasErrors ( ) ) return reject ( new Error ( stats . toString ( "errors-only" ) ) ) ;
3238 const totalBytes = Object . values ( stats . compilation . assets ) . reduce ( ( sum , a ) => sum + a . size ( ) , 0 ) ;
3339 resolve ( { bundler : "webpack" , bytes : totalBytes } ) ;
34- }
40+ } ,
3541 ) ;
3642 } ) ;
3743 }
@@ -49,11 +55,11 @@ export class BundlerSizeBenchmarker {
4955 entry : path . resolve ( APPLICATIONS_DIR , this . application ) ,
5056 name : "dist" ,
5157 fileName : ( ) => `rollup-${ this . application } .js` ,
52- formats : [ "umd " ] ,
58+ formats : [ "es " ] ,
5359 } ,
5460 minify : true ,
5561 emptyOutDir : false ,
56- rollupOptions : { external : [ ] , output : { inlineDynamicImports : true } } ,
62+ rollupOptions : { external : [ ] , output : { codeSplitting : false } } ,
5763 } ,
5864 } ) ;
5965 return { bundler : "rollup" , bytes : fs . statSync ( outfile ) . size } ;
0 commit comments