Skip to content

Commit

Permalink
Automatically splitting vendor
Browse files Browse the repository at this point in the history
  • Loading branch information
lyyourc committed May 3, 2017
1 parent 4af7b5b commit 7a6f534
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ var HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
entry: {
app: './src/main.js',
vendor: [ 'vue', 'axios' ],
},
output: {
path: path.resolve(__dirname, './dist'),
Expand Down Expand Up @@ -67,6 +66,11 @@ if (process.env.NODE_ENV === 'production') {

new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: ({ resource }) => (
resource &&
resource.indexOf('node_modules') >= 0 &&
resource.match(/\.js$/)
),
}),

new webpack.DefinePlugin({
Expand Down

0 comments on commit 7a6f534

Please sign in to comment.