Skip to content

Instantly share code, notes, and snippets.

@lcfd
Forked from albertfdp/webpack.config.js
Last active November 15, 2016 10:02
Show Gist options
  • Save lcfd/216d0d42a861136240db8fe546be6d79 to your computer and use it in GitHub Desktop.
Save lcfd/216d0d42a861136240db8fe546be6d79 to your computer and use it in GitHub Desktop.
All kinds of webpack configs. [ normal, react + .babelrc ]
{
"presets": ["react", "es2015", "stage-0"]
}
module.exports = {
entry: './src/index.js',
output: {
path: './build',
filename: 'bundle.js'
}
}
var debug = process.env.NODE_ENV !== "production";
var path = require('path');
var webpack = require('webpack');
var config = {
devtool: 'cheap-module-source-map',
entry: ['./src/main.js'],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/dist/'
},
module: {
loaders: [
{
test: /\.js$/,
loaders: ['babel'],
exclude: /node_modules/
}
]
},
plugins: [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
})
]
};
module.exports = config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment