Skip to content

Commit f7ee30b

Browse files
authored
fix: [plugin] Use compiler.webpack when possible (#1822)
fixes #1781
1 parent b53ae44 commit f7ee30b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/plugin-webpack5.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ const ruleSetCompiler = new RuleSetCompiler([
3131

3232
class VueLoaderPlugin {
3333
apply (compiler) {
34+
const normalModule = compiler.webpack.NormalModule || require("webpack/lib/NormalModule")
3435
// add NS marker so that the loader can detect and report missing plugin
3536
compiler.hooks.compilation.tap(id, compilation => {
36-
const normalModuleLoader = require('webpack/lib/NormalModule').getCompilationHooks(compilation).loader
37+
const normalModuleLoader = normalModule.getCompilationHooks(compilation).loader
3738
normalModuleLoader.tap(id, loaderContext => {
3839
loaderContext[NS] = true
3940
})

0 commit comments

Comments
 (0)