mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-07 14:17:16 +02:00
feat(v2): better webpack splitchunks optimization (#1565)
* feat(v2): better webpack splitchunks optimization * tweak * comment
This commit is contained in:
parent
937be4d231
commit
a0777f7c57
1 changed files with 14 additions and 1 deletions
|
@ -81,6 +81,20 @@ export function createBaseConfig(
|
|||
cacheGroups: {
|
||||
// disable the built-in cacheGroups
|
||||
default: false,
|
||||
vendor: {
|
||||
test: /[\\/]node_modules[\\/]/,
|
||||
priority: 30,
|
||||
minSize: 250000,
|
||||
name(module) {
|
||||
// get the package name. E.g. node_modules/packageName/not/this/part
|
||||
const packageName = module.context.match(
|
||||
/[\\/]node_modules[\\/](.*?)([\\/]|$)/,
|
||||
)[1];
|
||||
|
||||
// some servers don't like @ symbols as filename
|
||||
return `${packageName.replace('@', '')}`;
|
||||
},
|
||||
},
|
||||
vendors: {
|
||||
test: /[\\/]node_modules[\\/]/,
|
||||
name: 'vendors',
|
||||
|
@ -90,7 +104,6 @@ export function createBaseConfig(
|
|||
},
|
||||
common: {
|
||||
name: 'common',
|
||||
chunks: 'all',
|
||||
minChunks: 2,
|
||||
priority: 10,
|
||||
reuseExistingChunk: true,
|
||||
|
|
Loading…
Add table
Reference in a new issue