Skip to content

Commit

Permalink
fix: webpack 3 RuleSet creation (#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
mzgoddard authored Jul 12, 2018
1 parent 3f0b438 commit 6551c8e
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions lib/util/serial.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,20 @@ const loaders = (exports.loaders = {
ruleSet = extra.compiler.__hardSource_ruleSet;
if (!ruleSet) {
const RuleSet = require('webpack/lib/RuleSet');
ruleSet = extra.compiler.__hardSource_ruleSet = new RuleSet(
extra.compiler.options.module.defaultRules.concat(
extra.compiler.options.module.rules,
),
);
if (extra.compiler.options.module.defaultRules) {
// webpack 4
ruleSet = extra.compiler.__hardSource_ruleSet = new RuleSet(
extra.compiler.options.module.defaultRules.concat(
extra.compiler.options.module.rules,
),
);
} else {
// webpack <4
ruleSet = extra.compiler.__hardSource_ruleSet = new RuleSet(
extra.compiler.options.module.rules ||
extra.compiler.options.module.loaders,
);
}
}
}
return {
Expand Down

0 comments on commit 6551c8e

Please sign in to comment.