Skip to content

Instantly share code, notes, and snippets.

@scurker
Created February 8, 2017 19:09
Show Gist options
  • Save scurker/838c8d41795a39d851a3e88852f81caf to your computer and use it in GitHub Desktop.
Save scurker/838c8d41795a39d851a3e88852f81caf to your computer and use it in GitHub Desktop.
const webpack = require('webpack')
, path = require('path');
module.exports = {
entry: {
'global': './src/app.jsx',
},
resolve: {
extensions: ['.js', '.jsx']
},
devtool: 'source-map',
module: {
rules: [{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
cacheDirectory: true
}
}]
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
output: {
comments: false
}
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'global',
minChunks: 2,
children: true
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'commons',
minChunks: 2,
children: true
}),
new webpack.DefinePlugin({
APP_ENV: JSON.stringify('browser')
})
],
output: {
path: path.join(__dirname, './public/assets'),
publicPath: '/assets/',
filename: '[name].js',
sourceMapFilename: '[file].map'
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment