Skip to content

Commit

Permalink
feat: support Rule.rules (nested rules) (#1618)
Browse files Browse the repository at this point in the history
  • Loading branch information
opl- authored and haoqunjiang committed Dec 27, 2019
1 parent 6d177dc commit 5943319
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/plugin-webpack4.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 4 additions & 0 deletions lib/plugin-webpack5.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down

0 comments on commit 5943319

Please sign in to comment.