diff --git a/lib/plugin-webpack4.js b/lib/plugin-webpack4.js index 77fb65681..a56b5edce 100644 --- a/lib/plugin-webpack4.js +++ b/lib/plugin-webpack4.js @@ -146,6 +146,10 @@ function cloneRule (rule) { } }) + if (rule.rules) { + res.rules = rule.rules.map(cloneRule) + } + if (rule.oneOf) { res.oneOf = rule.oneOf.map(cloneRule) } diff --git a/lib/plugin-webpack5.js b/lib/plugin-webpack5.js index a3ec14dff..54086efb9 100644 --- a/lib/plugin-webpack5.js +++ b/lib/plugin-webpack5.js @@ -182,6 +182,10 @@ function cloneRule (rawRule, refs) { delete res.test + if (rawRule.rules) { + res.rules = rawRule.rules.map(rule => cloneRule(rule, refs)) + } + if (rawRule.oneOf) { res.oneOf = rawRule.oneOf.map(rule => cloneRule(rule, refs)) }