Skip to content

Instantly share code, notes, and snippets.

@reliq
Forked from learncodeacademy/webpack.config.js
Created October 1, 2016 06:17
Show Gist options
  • Save reliq/3d382d98e7eaa6cd63f77a31cbd8e93a to your computer and use it in GitHub Desktop.
Save reliq/3d382d98e7eaa6cd63f77a31cbd8e93a to your computer and use it in GitHub Desktop.
Sample Basic Webpack Config
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: "scripts.min.js"
},
plugins: debug ? [] : [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false }),
],
};
@reliq
Copy link
Author

reliq commented Oct 1, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment