File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919 " examples/"
2020 ],
2121 "scripts" : {
22- "build " : " webpack -p " ,
23- "prepublishOnly" : " npm run build " ,
22+ "buildProduction " : " webpack --env production " ,
23+ "prepublishOnly" : " npm run buildProduction " ,
2424 "lint" : " tslint -c tslint.json 'src/**/*.ts'"
2525 },
2626 "dependencies" : {
Original file line number Diff line number Diff line change 11const path = require ( 'path' )
2+ const MinifyPlugin = require ( "babel-minify-webpack-plugin" ) ;
23
3- module . exports = {
4- entry : './src/index.ts' ,
5- module : {
6- rules : [
7- {
8- test : / \. t s x ? $ / ,
9- loader : 'ts-loader' ,
10- exclude : / n o d e _ m o d u l e s /
11- } ,
12- {
13- test : / \. c s s $ / ,
14- use : [
15- {
16- loader : 'style-loader'
17- } ,
18- {
19- loader : 'css-loader' ,
20- options : {
21- modules : true ,
4+ module . exports = ( env ) => {
5+ let plugins = [ ]
6+ if ( env === 'production' )
7+ plugins = [ new MinifyPlugin ( ) ] ;
8+
9+ return {
10+ entry : './src/index.ts' ,
11+ module : {
12+ rules : [
13+ {
14+ test : / \. t s x ? $ / ,
15+ loader : 'ts-loader' ,
16+ exclude : / n o d e _ m o d u l e s /
17+ } ,
18+ {
19+ test : / \. c s s $ / ,
20+ use : [
21+ {
22+ loader : 'style-loader'
23+ } ,
24+ {
25+ loader : 'css-loader' ,
26+ options : {
27+ modules : true ,
28+ }
2229 }
23- }
24- ]
25- }
26- ]
27- } ,
28- resolve : {
29- extensions : [ ".ts" , ".js" ]
30- } ,
31- output : {
32- filename : 'index.js' ,
33- path : path . resolve ( __dirname , 'dist' ) ,
34- libraryTarget : "umd"
35- } ,
36- plugins : [
37- ]
30+ ]
31+ }
32+ ]
33+ } ,
34+ resolve : {
35+ extensions : [ ".ts" , ".js" ]
36+ } ,
37+ output : {
38+ filename : 'index.js' ,
39+ path : path . resolve ( __dirname , 'dist' ) ,
40+ libraryTarget : "umd"
41+ } ,
42+ plugins
43+ }
3844} ;
You can’t perform that action at this time.
0 commit comments