Skip to content

Instantly share code, notes, and snippets.

@eiriklv
Created November 26, 2015 13:57
Show Gist options
  • Save eiriklv/371acbbfb5d0034aa1d7 to your computer and use it in GitHub Desktop.
Save eiriklv/371acbbfb5d0034aa1d7 to your computer and use it in GitHub Desktop.
var webpack = require('webpack');
var isProduction = process.env.NODE_ENV == 'production';
var plugins = [];
if (isProduction) {
plugins.push(new webpack.optimize.UglifyJsPlugin())
}
module.exports = {
devtool: !isProduction ? 'inline-source-maps' : 'source-map',
entry: !isProduction ? [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
'./src/entry.js'
] : ['./src/entry.js'],
output: {
path: __dirname + '/public/',
publicPath: '/',
filename: 'bundle.js'
},
plugins: plugins,
module: {
loaders: [{
test: /\.jsx?$/,
loaders: isProduction ? ['babel'] : ['react-hot', 'babel'],
exclude: /node_modules/,
}, {
test: /\.scss$/,
loaders: ['style', 'css', 'autoprefixer', 'sass']
}]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment