mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-08 22:57:20 +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: {
|
cacheGroups: {
|
||||||
// disable the built-in cacheGroups
|
// disable the built-in cacheGroups
|
||||||
default: false,
|
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: {
|
vendors: {
|
||||||
test: /[\\/]node_modules[\\/]/,
|
test: /[\\/]node_modules[\\/]/,
|
||||||
name: 'vendors',
|
name: 'vendors',
|
||||||
|
@ -90,7 +104,6 @@ export function createBaseConfig(
|
||||||
},
|
},
|
||||||
common: {
|
common: {
|
||||||
name: 'common',
|
name: 'common',
|
||||||
chunks: 'all',
|
|
||||||
minChunks: 2,
|
minChunks: 2,
|
||||||
priority: 10,
|
priority: 10,
|
||||||
reuseExistingChunk: true,
|
reuseExistingChunk: true,
|
||||||
|
|
Loading…
Add table
Reference in a new issue