Skip to content

Commit c4c5f17

Browse files
committed
fix: fix webpack 5.48 compatibility
Fixes #1859
1 parent 689075d commit c4c5f17

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

lib/plugin-webpack5.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,21 @@ const id = 'vue-loader-plugin'
33
const NS = 'vue-loader'
44
const BasicEffectRulePlugin = require('webpack/lib/rules/BasicEffectRulePlugin')
55
const BasicMatcherRulePlugin = require('webpack/lib/rules/BasicMatcherRulePlugin')
6-
const DescriptionDataMatcherRulePlugin = require('webpack/lib/rules/DescriptionDataMatcherRulePlugin')
76
const RuleSetCompiler = require('webpack/lib/rules/RuleSetCompiler')
87
const UseEffectRulePlugin = require('webpack/lib/rules/UseEffectRulePlugin')
98

9+
const objectMatcherRulePlugins = []
10+
try {
11+
const ObjectMatcherRulePlugin = require('webpack/lib/rules/ObjectMatcherRulePlugin')
12+
objectMatcherRulePlugins.push(
13+
new ObjectMatcherRulePlugin('assert', 'assertions'),
14+
new ObjectMatcherRulePlugin('descriptionData')
15+
)
16+
} catch (e) {
17+
const DescriptionDataMatcherRulePlugin = require('webpack/lib/rules/DescriptionDataMatcherRulePlugin')
18+
objectMatcherRulePlugins.push(new DescriptionDataMatcherRulePlugin())
19+
}
20+
1021
const ruleSetCompiler = new RuleSetCompiler([
1122
new BasicMatcherRulePlugin('test', 'resource'),
1223
new BasicMatcherRulePlugin('mimetype'),
@@ -20,7 +31,7 @@ const ruleSetCompiler = new RuleSetCompiler([
2031
new BasicMatcherRulePlugin('realResource'),
2132
new BasicMatcherRulePlugin('issuer'),
2233
new BasicMatcherRulePlugin('compiler'),
23-
new DescriptionDataMatcherRulePlugin(),
34+
...objectMatcherRulePlugins,
2435
new BasicEffectRulePlugin('type'),
2536
new BasicEffectRulePlugin('sideEffects'),
2637
new BasicEffectRulePlugin('parser'),

0 commit comments

Comments
 (0)