@@ -7,19 +7,12 @@ const WebpackAssetsManifest = require('webpack-assets-manifest');
77const { SourceMapConsumer } = require ( 'source-map' ) ;
88const banner = fs . readFileSync ( './LICENSE' , 'utf8' ) . replace ( '{year}' , new Date ( ) . getFullYear ( ) ) ;
99
10- const config = {
10+ const baseConfig = {
1111 mode : 'production' ,
1212 watchOptions : {
1313 ignored : / n o d e _ m o d u l e s /
1414 } ,
1515 entry : './build/module/index.js' ,
16- output : {
17- library : {
18- type : 'umd' ,
19- } ,
20- path : path . resolve ( __dirname , 'build/browser' ) ,
21- filename : 'filestack.umd.js' ,
22- } ,
2316 module : {
2417 rules : [
2518 {
@@ -68,9 +61,9 @@ const config = {
6861 new webpack . BannerPlugin ( { banner } ) ,
6962 new webpack . DefinePlugin ( {
7063 'process.env.NODE_ENV' : JSON . stringify ( 'production' ) ,
71- '@{VERSION}' : JSON . stringify ( `${ require ( './package.json' ) . version } ` ) ,
64+ '@{VERSION}' : JSON . stringify ( `${ require ( './package.json' ) . version } ` ) ,
7265 } ) ,
73- new webpack . NormalModuleReplacementPlugin ( / \. n o d e $ / , ( resource ) => {
66+ new webpack . NormalModuleReplacementPlugin ( / \. n o d e $ / , ( resource ) => {
7467 resource . request = resource . request . replace ( / \. n o d e $ / , '.browser' ) ;
7568 } ) ,
7669 ] ,
@@ -90,17 +83,19 @@ const config = {
9083 } ,
9184} ;
9285
93- const umd = merge ( { } , config , {
86+ const umd = merge ( { } , baseConfig , {
9487 output : {
95- library : {
96- type : 'umd' ,
97- } ,
88+ path : path . resolve ( __dirname , 'build/browser' ) ,
9889 filename : 'filestack.umd.js' ,
90+ library : 'filestack' ,
91+ libraryTarget : 'umd' ,
92+
9993 } ,
10094} ) ;
10195
102- const esm = merge ( { } , config , {
96+ const esm = merge ( { } , baseConfig , {
10397 output : {
98+ path : path . resolve ( __dirname , 'build/browser' ) ,
10499 filename : 'filestack.esm.js' ,
105100 library : {
106101 type : 'module' ,
@@ -115,12 +110,12 @@ const esm = merge({}, config, {
115110 } ,
116111} ) ;
117112
118- const prod = merge ( { } , config , {
113+ const prod = merge ( { } , baseConfig , {
119114 output : {
120- library : {
121- type : 'umd' ,
122- } ,
115+ path : path . resolve ( __dirname , 'build/browser' ) ,
123116 filename : 'filestack.min.js' ,
117+ library : 'filestack' ,
118+ libraryTarget : 'umd'
124119 } ,
125120 plugins : [
126121 new WebpackAssetsManifest ( {
@@ -131,4 +126,4 @@ const prod = merge({}, config, {
131126 ] ,
132127} ) ;
133128
134- module . exports = { umd, esm, prod } ;
129+ module . exports = [ umd , esm , prod ] ;
0 commit comments