Skip to content

Commit

Permalink
fix: [plugin] Use compiler.webpack when possible (#1822)
Browse files Browse the repository at this point in the history
fixes #1781
  • Loading branch information
artagnon authored May 11, 2021
1 parent b53ae44 commit f7ee30b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/plugin-webpack5.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ const ruleSetCompiler = new RuleSetCompiler([

class VueLoaderPlugin {
apply (compiler) {
const normalModule = compiler.webpack.NormalModule || require("webpack/lib/NormalModule")
// add NS marker so that the loader can detect and report missing plugin
compiler.hooks.compilation.tap(id, compilation => {
const normalModuleLoader = require('webpack/lib/NormalModule').getCompilationHooks(compilation).loader
const normalModuleLoader = normalModule.getCompilationHooks(compilation).loader
normalModuleLoader.tap(id, loaderContext => {
loaderContext[NS] = true
})
Expand Down

0 comments on commit f7ee30b

Please sign in to comment.