From a85e4cc58a35b07420b5fbbb35dc3cbc4fb1dced Mon Sep 17 00:00:00 2001 From: opl- Date: Fri, 20 Dec 2019 17:26:34 +0100 Subject: [PATCH] Fix Rule.rules (nested rules) not supported --- lib/plugin-webpack4.js | 4 ++++ lib/plugin-webpack5.js | 4 ++++ 2 files changed, 8 insertions(+) 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)) }