diff --git a/package.json b/package.json index 0eca0742..f662da7d 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.html", "scripts": { "lint": "eslint js/*.js js/*.jsx", - "build": "webpack --optimize-minimize", + "build": "webpack --config=webpack.production.config.js", "serve": "webpack-dev-server", "weight": "npm run build && gzip-size built/winamp.js | pretty-bytes", "test": "jest && npm run lint", diff --git a/webpack.config.js b/webpack.config.js index d459b17c..012dd777 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,14 +1,6 @@ -var path = require('path'); -var webpack = require('webpack'); +const path = require('path'); module.exports = { - plugins: [ - new webpack.DefinePlugin({ - 'process.env': { - 'NODE_ENV': JSON.stringify('production') - } - }) - ], module: { loaders: [ { diff --git a/webpack.production.config.js b/webpack.production.config.js new file mode 100644 index 00000000..b99197f8 --- /dev/null +++ b/webpack.production.config.js @@ -0,0 +1,13 @@ +const config = require('./webpack.config'); +const webpack = require('webpack'); + +config.plugins = (config.plugins || []).concat([ + new webpack.DefinePlugin({ + 'process.env': { + 'NODE_ENV': JSON.stringify('production') + } + }), + new webpack.optimize.UglifyJsPlugin() +]); + +module.exports = config;