Optimize loading of date-fns
This commit is contained in:
@@ -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}`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user