Last active
February 16, 2017 15:00
-
-
Save mdamien/b290e46bd5d1e0f2cd730bcf3635394c to your computer and use it in GitHub Desktop.
Webpack 2: react + code splitting, to be used via "webpack --progress --watch"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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