@@ -38,8 +38,8 @@ async function minify({ code, pkg, bundleName }) {
3838 mangle : true ,
3939 } ) ;
4040
41- const fileName = bundleName . replace ( / \. j s $ / , '.min .js' ) ;
42- const filePath = `${ pkgout } /${ fileName } ` ;
41+ const fileName = bundleName . replace ( / \. j s $ / , '.prod .js' ) ;
42+ const filePath = `${ pkgout } /${ fileName } .mjs ` ;
4343 fs . outputFileSync ( filePath , output . code ) ;
4444 const stats = reportSize ( { code : output . code , path : filePath } ) ;
4545 console . log ( `${ chalk . green ( 'Output File:' ) } ${ fileName } ${ stats } ` ) ;
@@ -64,7 +64,9 @@ async function build(pkg) {
6464
6565 console . log ( chalk . magenta ( `Generating bundle for ${ pkg } ` ) ) ;
6666 const pkgout = path . join ( __dirname , `../packages/${ pkg } /dist` ) ;
67- for ( const format of [ 'es' , 'umd' ] ) {
67+ await fs . emptyDir ( pkgout ) ;
68+
69+ for ( const format of [ 'esm' , 'iife' , 'cjs' ] ) {
6870 const { input, output, bundleName } = await createConfig ( pkg , format ) ;
6971 const bundle = await rollup ( input ) ;
7072 const {
@@ -74,10 +76,10 @@ async function build(pkg) {
7476 const outputPath = path . join ( pkgout , bundleName ) ;
7577 fs . outputFileSync ( outputPath , code ) ;
7678 const stats = reportSize ( { code, path : outputPath } ) ;
77-
79+
7880 console . log ( `${ chalk . green ( 'Output File:' ) } ${ bundleName } ${ stats } ` ) ;
7981
80- if ( format === 'umd ' ) {
82+ if ( format === 'iife ' ) {
8183 await minify ( { bundleName, pkg, code } ) ;
8284 }
8385 }
0 commit comments