Optimize loading of date-fns
This commit is contained in:
parent
88a01888bf
commit
b3febe49ad
4 changed files with 97 additions and 74 deletions
|
@ -113,6 +113,21 @@ const config = {
|
|||
return `node_modules.${parts[0]}.${parts[1]}`;
|
||||
}
|
||||
|
||||
if (packageName === 'date-fns') {
|
||||
const parts = module.context
|
||||
.substring(module.context.lastIndexOf(packageName))
|
||||
.split(/[\\/]/);
|
||||
|
||||
let name = `node_modules.${parts[0]}`;
|
||||
if (parts[1]) {
|
||||
name += `.${parts[1]}`;
|
||||
}
|
||||
if (parts[1] === 'locale') {
|
||||
name += `.${parts[2]}`;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
return `node_modules.${packageName}`;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue