Skip to content
Permalink
Browse files

reduce js file size (use splitChunks)

  • Loading branch information
kaishuu0123 committed Oct 18, 2019
1 parent 46c78cb commit 02844ce8b4b472a2acebbcf89d6abcdb2efab566
Showing with 22 additions and 1 deletion.
  1. +22 −1 config/webpack/environment.js
@@ -4,7 +4,28 @@ const webpack = require('webpack')
const vue = require('./loaders/vue')

// enable SplitChunks
environment.splitChunks()
environment.splitChunks((config) => {
return Object.assign({}, config, {
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
test:/node_modules/,
name: 'vendor',
chunks: 'initial',
enforce: true
},
rebacklogsCommons: {
test: /app\/javascript\/commons/,
name: 'rebacklogs-commons',
chunks: 'initial',
enforce: true
}
}
}
}
})
})

environment.plugins.append('Provide', new webpack.ProvidePlugin({
$: 'jquery',

0 comments on commit 02844ce

Please sign in to comment.
You can’t perform that action at this time.