Skip to content

Commit 820d23c

Browse files
authored
fix(plugin): use compiler.webpack when possible (#1884)
1 parent 2eccc0e commit 820d23c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/pluginWebpack5.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,16 @@ class VueLoaderPlugin implements Plugin {
9898
static NS = NS
9999

100100
apply(compiler: Compiler) {
101+
// @ts-ignore
102+
const normalModule = compiler.webpack.NormalModule || NormalModule
103+
101104
// add NS marker so that the loader can detect and report missing plugin
102105
compiler.hooks.compilation.tap(id, (compilation) => {
103-
NormalModule.getCompilationHooks(compilation).loader.tap(
104-
id,
105-
(loaderContext: any) => {
106+
normalModule
107+
.getCompilationHooks(compilation)
108+
.loader.tap(id, (loaderContext: any) => {
106109
loaderContext[NS] = true
107-
}
108-
)
110+
})
109111
})
110112

111113
const rules = compiler.options.module!.rules

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy