1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-25 16:59:17 +01:00

split angular into its own chunk

This commit is contained in:
Kyle Spearrin 2020-09-15 16:13:07 -04:00
parent 2e346dbe2f
commit 5994637522

View File

@ -75,7 +75,7 @@ const plugins = [
new HtmlWebpackPlugin({
template: './src/popup/index.html',
filename: 'popup/index.html',
chunks: ['popup/vendor', 'popup/main'],
chunks: ['popup/vendor-angular', 'popup/vendor', 'popup/main'],
}),
new HtmlWebpackPlugin({
template: './src/background.html',
@ -144,12 +144,26 @@ const config = {
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
test(module, chunks) {
return module.resource != null &&
module.resource.includes(`${path.sep}node_modules${path.sep}`) &&
!module.resource.includes(`${path.sep}node_modules${path.sep}@angular${path.sep}`);
},
name: 'popup/vendor',
chunks: (chunk) => {
return chunk.name === 'popup/main';
},
},
angular: {
test(module, chunks) {
return module.resource != null &&
module.resource.includes(`${path.sep}node_modules${path.sep}@angular${path.sep}`);
},
name: 'popup/vendor-angular',
chunks: (chunk) => {
return chunk.name === 'popup/main';
},
},
commons2: {
test: /[\\/]node_modules[\\/]/,
name: 'vendor',