Skip to content

Commit

Permalink
fix(plugin): use compiler.webpack when possible (#1884)
Browse files Browse the repository at this point in the history
  • Loading branch information
sevilyilmaz authored Oct 10, 2021
1 parent 2eccc0e commit 820d23c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/pluginWebpack5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,16 @@ class VueLoaderPlugin implements Plugin {
static NS = NS

apply(compiler: Compiler) {
// @ts-ignore
const normalModule = compiler.webpack.NormalModule || NormalModule

// add NS marker so that the loader can detect and report missing plugin
compiler.hooks.compilation.tap(id, (compilation) => {
NormalModule.getCompilationHooks(compilation).loader.tap(
id,
(loaderContext: any) => {
normalModule
.getCompilationHooks(compilation)
.loader.tap(id, (loaderContext: any) => {
loaderContext[NS] = true
}
)
})
})

const rules = compiler.options.module!.rules
Expand Down

0 comments on commit 820d23c

Please sign in to comment.