1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-25 12:15:18 +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({ new HtmlWebpackPlugin({
template: './src/popup/index.html', template: './src/popup/index.html',
filename: 'popup/index.html', filename: 'popup/index.html',
chunks: ['popup/vendor', 'popup/main'], chunks: ['popup/vendor-angular', 'popup/vendor', 'popup/main'],
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: './src/background.html', template: './src/background.html',
@ -144,12 +144,26 @@ const config = {
splitChunks: { splitChunks: {
cacheGroups: { cacheGroups: {
commons: { 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', name: 'popup/vendor',
chunks: (chunk) => { chunks: (chunk) => {
return chunk.name === 'popup/main'; 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: { commons2: {
test: /[\\/]node_modules[\\/]/, test: /[\\/]node_modules[\\/]/,
name: 'vendor', name: 'vendor',