Here\'s my webpack.config.js
var webpack = require(\"webpack\");
module.exports = {
entry: \"./entry.js\",
devtool: \"source-map\",
outp
You can format your webpack.config.js like this:
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./entry.js",
output: {
path: __dirname + "/dist",
filename: "library.min.js"
},
plugins: debug ? [] : [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false }),
],
};'
And then to build it unminified run (while in the project's main directory):
$ webpack
To build it minified run:
$ NODE_ENV=production webpack
Notes:
Make sure that for the unminified version you change the output file name to library.js
and for the minified library.min.js
so they do not overwrite each other.