Skip to content

Instantly share code, notes, and snippets.

@arackaf
Last active February 14, 2017 05:52
Show Gist options
  • Select an option

  • Save arackaf/5aff90f1ee503a68fcbce4aa9d1e9ac2 to your computer and use it in GitHub Desktop.

Select an option

Save arackaf/5aff90f1ee503a68fcbce4aa9d1e9ac2 to your computer and use it in GitHub Desktop.
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
var path = require('path');
var webpack = require('webpack');
module.exports = {
entry: './reactStartup.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
},
resolve: {
alias: {
'simple-react-bootstrap': 'node_modules/simple-react-bootstrap/dist/simple-react-bootstrap.js',
'jscolor': 'util/jscolor.js'
},
modules: [
path.resolve('./'),
path.resolve('./node_modules'),
]
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['react', 'es2015']
}
}
]
},
plugins: [
new BundleAnalyzerPlugin({
analyzerMode: 'static'
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'node-static',
filename: 'node-static.js',
minChunks(module, count) {
var context = module.context;
return context && context.indexOf('node_modules') >= 0;
},
}),
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment