Skip to content

Instantly share code, notes, and snippets.

@mdamien
Last active February 16, 2017 15:00
Show Gist options
  • Select an option

  • Save mdamien/b290e46bd5d1e0f2cd730bcf3635394c to your computer and use it in GitHub Desktop.

Select an option

Save mdamien/b290e46bd5d1e0f2cd730bcf3635394c to your computer and use it in GitHub Desktop.
Webpack 2: react + code splitting, to be used via "webpack --progress --watch"
var path = require('path');
var webpack = require('webpack');
module.exports = {
devtool: 'source-map',
entry: {
graph: './src/graph.js',
vendor: ['react', 'react-dom'],
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist')
},
module: {
rules: [
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' },
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor'
})
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment