From b1701b09bdd95b07cd11fea77d54117383bb4397 Mon Sep 17 00:00:00 2001 From: Aaron Jensen Date: Sun, 9 Aug 2015 22:40:23 -0700 Subject: [PATCH] Build the minified version in production mode This is probably not the way to do this, I may want to just have multiple versions, dev+production * full+min --- createWebpackConfig.js | 23 ++++++++++++++++++----- gulpfile.js | 1 + 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/createWebpackConfig.js b/createWebpackConfig.js index fadd68d..582dae4 100644 --- a/createWebpackConfig.js +++ b/createWebpackConfig.js @@ -29,11 +29,24 @@ module.exports = function createWebpackConfig(_options) { config.output.filename = options.filename; if (options.minify) { - config.plugins.push(new webpack.optimize.UglifyJsPlugin({ - compressor: { - screw_ie8: true, - }, - })); + config.plugins.push( + new webpack.optimize.UglifyJsPlugin({ + compressor: { + screw_ie8: true, + warnings: false, + }, + }) + ); + } + + if (options.env) { + config.plugins.push( + new webpack.DefinePlugin({ + 'process.env': { + NODE_ENV: JSON.stringify(options.env), + }, + }) + ); } return config; diff --git a/gulpfile.js b/gulpfile.js index 15627c4..d54480b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -76,6 +76,7 @@ gulp.task('webpack:standalone:min', function() { var config = createWebpackConfig({ filename: 'updeep-standalone.min.js', minify: true, + env: 'production', }); return gulp.src('lib/index.js')