@@ -59,7 +59,7 @@ const libBundle = createWebpackConfig({
5959 } ,
6060} ) ;
6161
62- const umdBundle = createWebpackConfig ( {
62+ const globalBundle = createWebpackConfig ( {
6363 mode : 'production' ,
6464 tsconfigPath : path . join ( __dirname , '../../../tsconfig.json' ) ,
6565 outputPath : path . join ( __dirname , '../../alex/bundle' ) ,
@@ -70,34 +70,19 @@ const umdBundle = createWebpackConfig({
7070 webpackConfig : {
7171 context : path . join ( __dirname , '../../..' ) ,
7272 entry : {
73- [ config . appUmdEntry ] : './packages/alex/src' ,
74- [ config . appUmdMinEntry ] : './packages/alex/src' ,
73+ [ config . appGlobalEntry ] : './packages/alex/src' ,
74+ [ config . appGlobalMinEntry ] : './packages/alex/src' ,
7575 } ,
7676 // 此处 bundle 的包仅作为 commonjs 使用,但因为 external 原因会导致 webpack4 加载 bundle 出错,因此还是使用 umd
7777 output : {
7878 library : 'Alex' ,
79- libraryTarget : 'umd ' ,
79+ libraryTarget : 'global ' ,
8080 } ,
8181 externals : [
8282 {
83- react : {
84- root : 'React' ,
85- commonjs2 : 'react' ,
86- commonjs : 'react' ,
87- amd : 'react' ,
88- } ,
89- 'react-dom' : {
90- root : 'ReactDOM' ,
91- commonjs2 : 'react-dom' ,
92- commonjs : 'react-dom' ,
93- amd : 'react-dom' ,
94- } ,
95- moment : {
96- root : 'moment' ,
97- commonjs2 : 'moment' ,
98- commonjs : 'moment' ,
99- amd : 'moment' ,
100- } ,
83+ react : 'react' ,
84+ 'react-dom' : 'ReactDOM' ,
85+ moment : 'moment' ,
10186 } ,
10287 ] ,
10388 optimization : {
@@ -116,4 +101,4 @@ const umdBundle = createWebpackConfig({
116101 } ,
117102} ) ;
118103
119- module . exports = libBundle ;
104+ module . exports = [ libBundle , globalBundle ] ;
0 commit comments