@@ -38,6 +38,7 @@ program
3838 . option ( '-o, --open' , 'Open browser' )
3939 . option ( '--proxy [url]' , 'Proxy API request' )
4040 . option ( '--lib [libraryName]' , 'Distribute component in UMD format' )
41+ . option ( '--disable-compress' , 'Disable compress when building in production mode' )
4142 . parse ( process . argv )
4243
4344var args = program . args
@@ -75,7 +76,8 @@ var options = merge({
7576 proxy : program . proxy ,
7677 production : program . production ,
7778 lib : program . lib ,
78- watch : program . watch
79+ watch : program . watch ,
80+ disableCompress : program . disableCompress
7981} )
8082
8183function help ( ) {
@@ -248,23 +250,37 @@ if (isYarn(__dirname)) {
248250}
249251
250252if ( production ) {
251- webpackConfig . devtool = 'source-map'
252253 webpackConfig . plugins . push (
253254 new ProgressPlugin ( ) ,
254- new webpack . optimize . UglifyJsPlugin ( {
255+ new webpack . LoaderOptionsPlugin ( {
256+ minimize : ! options . disableCompress
257+ } ) ,
258+ new ExtractTextPlugin ( filenames . css )
259+ )
260+
261+ if ( options . disableCompress ) {
262+ webpackConfig . devtool = false
263+ } else {
264+ webpackConfig . devtool = 'source-map'
265+ webpackConfig . plugins . push ( new webpack . optimize . UglifyJsPlugin ( {
255266 sourceMap : true ,
256267 compressor : {
257- warnings : false
268+ warnings : false ,
269+ conditionals : true ,
270+ unused : true ,
271+ comparisons : true ,
272+ sequences : true ,
273+ dead_code : true ,
274+ evaluate : true ,
275+ if_return : true ,
276+ join_vars : true ,
277+ negate_iife : false
258278 } ,
259279 output : {
260280 comments : false
261281 }
262- } ) ,
263- new webpack . LoaderOptionsPlugin ( {
264- minimize : true
265- } ) ,
266- new ExtractTextPlugin ( filenames . css )
267- )
282+ } ) )
283+ }
268284} else {
269285 if ( ! options . watch ) {
270286 webpackConfig . plugins . push ( new webpack . HotModuleReplacementPlugin ( ) )
0 commit comments