Skip to content

Commit

Permalink
refactor: updated split chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Weber committed May 27, 2021
1 parent 83dfd68 commit 8817aec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions packages/@averjs/renderer/lib/config/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ export default class WebpackBaseConfiguration {
}
]);

// TODO: use new asset modules https://webpack.js.org/guides/asset-modules/

this.chainConfig.module
.rule('fonts')
.test(/\.(woff2?|eot|ttf|otf)(\?.*)?$/)
Expand Down
16 changes: 12 additions & 4 deletions packages/@averjs/renderer/lib/config/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,18 @@ export default class WebpackClientConfiguration extends WebpackBaseConfiguration

const splitChunks: SplitChunksOptions = {
cacheGroups: {
commons: {
test: /node_modules[/\\](vue|vue-loader|vue-router|vuex|vue-meta|core-js|babel-runtime|es6-promise|axios|webpack|setimmediate|timers-browserify|process|regenerator-runtime|cookie|js-cookie|is-buffer|dotprop)[/\\].*\.js$/,
chunks: 'all',
priority: 10
defaultVendors: {
name: 'vendors',
test: /[/\\]node_modules[/\\]/,
priority: -10,
chunks: 'initial'
},
common: {
name: 'common',
minChunks: 2,
priority: -20,
chunks: 'initial',
reuseExistingChunk: true
}
}
};
Expand Down

0 comments on commit 8817aec

Please sign in to comment.