Skip to content

Instantly share code, notes, and snippets.

@stinkymonkeyph
Forked from learncodeacademy/webpack.config.js
Last active July 10, 2017 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stinkymonkeyph/6be44f106bbd23f8108356cc1754904d to your computer and use it in GitHub Desktop.
Save stinkymonkeyph/6be44f106bbd23f8108356cc1754904d to your computer and use it in GitHub Desktop.
Sample Basic Webpack Config
//public/asset/js
//client.js
//client.min.js
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname + "/public",
devtool: debug ? "inline-sourcemap" : null,
entry: "./asset/js/client.js",
module: {
loaders: [
{
test: /\.js?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: ['react', 'es2015', 'stage-0'],
plugins: [
'react-html-attrs',
'transform-class-properties',
'transform-decorators-legacy'
]
}
}
]
},
output: {
path: __dirname + "/public/asset/js/",
filename: "client.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