fix build error

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2021-10-12 12:19:51 +02:00
parent c6f927d819
commit 9e5005a4cf
+7 -3
View File
@@ -26,7 +26,7 @@ export const optimization = (
return {
minimize: !isDev,
// Only configure when parallel is explicitly overriden from the default
// Only configure when parallel is explicitly overridden from the default
...(!isParallelDefault(options.parallel)
? {
minimizer: [
@@ -45,11 +45,15 @@ export const optimization = (
// enough, if they're smaller they end up in the main
packages: {
chunks: 'initial',
test: /[\\/]node_modules[\\/]/,
test(module: any) {
return Boolean(
module?.resource?.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/),
);
},
name(module: any) {
// get the name. E.g. node_modules/packageName/not/this/part.js
// or node_modules/packageName
const packageName = module.context.match(
const packageName = module.resource.match(
/[\\/]node_modules[\\/](.*?)([\\/]|$)/,
)[1];