File tree Expand file tree Collapse file tree 1 file changed +24
-15
lines changed
Expand file tree Collapse file tree 1 file changed +24
-15
lines changed Original file line number Diff line number Diff line change 11const pkg = require ( './package.json' ) ;
22
3- const comment = `@yama-dev/${ pkg . name } Version ${ pkg . version } Repository ${ pkg . repository . url } Copyright ${ pkg . author } Licensed ${ pkg . license } ` ;
3+ const comment = `/*! @yama-dev/${ pkg . name } Version ${ pkg . version } Repository ${ pkg . repository . url } Copyright ${ pkg . author } Licensed ${ pkg . license } */ ` ;
44
55const env = process . env . NODE_ENV ;
66
7+ if ( ! env ) process . exit ( 1 ) ;
8+
79const webpack = require ( 'webpack' ) ;
10+ const TerserPlugin = require ( 'terser-webpack-plugin' ) ;
811
912const webpackPlugEnv = new webpack . EnvironmentPlugin ( {
10- NODE_ENV : 'development' ,
1113 DEBUG : false ,
1214 VERSION : pkg . version
1315} ) ;
1416
15- const webpackPlugBnr = new webpack . BannerPlugin ( {
16- banner : comment ,
17- } ) ;
18-
19- const babelPlugin = [
20- '@babel/plugin-transform-object-assign'
21- ] ;
22-
2317const config = {
2418 mode : env || 'development' ,
2519 entry : {
@@ -42,7 +36,7 @@ const config = {
4236 } ,
4337 {
4438 test : / \. j s $ / ,
45- exclude : / n o d e _ m o d u l e s [ / / \ /] (? ! ( @ y a m a \ -d e v ) \/ ) .* / ,
39+ exclude : / n o d e _ m o d u l e s [ / / / ] (? ! ( @ y a m a - d e v ) \/ ) .* / ,
4640 use : {
4741 loader : 'babel-loader' ,
4842 options : {
@@ -53,17 +47,32 @@ const config = {
5347 modules : false
5448 }
5549 ]
56- ] ,
57- plugins : babelPlugin
50+ ]
5851 }
5952 }
6053 }
6154 ]
6255 } ,
56+ target : [ 'web' , 'es5' ] ,
6357 plugins : [
6458 webpackPlugEnv ,
65- webpackPlugBnr
66- ]
59+ ] ,
60+ optimization : {
61+ minimizer : [
62+ new TerserPlugin ( {
63+ extractComments : false ,
64+ terserOptions : {
65+ output : {
66+ preamble : comment ,
67+ comments : false ,
68+ } ,
69+ compress : {
70+ drop_console : true
71+ }
72+ } ,
73+ } ) ,
74+ ] ,
75+ }
6776} ;
6877
6978module . exports = config ;
You can’t perform that action at this time.
0 commit comments