Skip to content

Instantly share code, notes, and snippets.

@SteveBate
Created April 14, 2016 14:43
Show Gist options
  • Save SteveBate/f6fa1199175aa2245cabd311f4c30a82 to your computer and use it in GitHub Desktop.
Save SteveBate/f6fa1199175aa2245cabd311f4c30a82 to your computer and use it in GitHub Desktop.
A simple starter configuration file for webpack
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "eval-source-map" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: debug ? "bundle.js" : "bundle.min.js"
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel', // 'babel-loader' is also a legal name to reference
query: {
presets: ['react', 'es2015', 'stage-1']
}
}
]
},
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