Last active
February 5, 2017 00:59
-
-
Save BindiChen/ac1bf6db80b8b142410a91113570c5fc to your computer and use it in GitHub Desktop.
Sample Basic Webpack Config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var debug = process.env.NODE_ENV !== "production"; | |
var webpack = require('webpack'); | |
module.exports = { | |
context: __dirname, | |
devtool: debug ? "inline-sourcemap" : false, | |
entry: "./js/scripts.js", | |
output: { | |
path: __dirname + "/js", | |
filename: "scripts.min.js" | |
}, | |
plugins: debug ? [] : [ | |
new webpack.optimize.DedupePlugin(), | |
new webpack.optimize.OccurrenceOrderPlugin(), | |
new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false }), | |
], | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a sample Webpack configuration.
Just run
webpack
and it will produce unminified output with sourcemaps.Run
NODE_ENV=production webpack
and it will minify the output and de-dupe all the unnecessary code.