Skip to content

Instantly share code, notes, and snippets.

@keomony
Last active September 20, 2018 11:52
Show Gist options
  • Save keomony/2770e9645e61fa0104445edc46a1b810 to your computer and use it in GitHub Desktop.
Save keomony/2770e9645e61fa0104445edc46a1b810 to your computer and use it in GitHub Desktop.
# npm install -g webpack
//Javascript module loader
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname, //source code directory
devtool: debug ? "inline-sourcemap" : null, //inline-sourcemap only in non-production
entry: "./js/scripts.js", //entry point
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 }),
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment