Commit 7275ae42 authored by Xin Du (Clark)'s avatar Xin Du (Clark) Committed by Haoqun Jiang

feat: support webpack 5 hooks (#1469)

parent d7024d19
...@@ -10,7 +10,14 @@ class VueLoaderPlugin { ...@@ -10,7 +10,14 @@ class VueLoaderPlugin {
if (compiler.hooks) { if (compiler.hooks) {
// webpack 4 // webpack 4
compiler.hooks.compilation.tap(id, compilation => { compiler.hooks.compilation.tap(id, compilation => {
compilation.hooks.normalModuleLoader.tap(id, loaderContext => { let normalModuleLoader
if (Object.isFrozen(compilation.hooks)) {
// webpack 5
normalModuleLoader = require('webpack/lib/NormalModule').getCompilationHooks(compilation).loader
} else {
normalModuleLoader = compilation.hooks.normalModuleLoader
}
normalModuleLoader.tap(id, loaderContext => {
loaderContext[NS] = true loaderContext[NS] = true
}) })
}) })
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
}, },
"peerDependencies": { "peerDependencies": {
"css-loader": "*", "css-loader": "*",
"webpack": "^4.1.0" "webpack": "^4.1.0 || ^5.0.0-0"
}, },
"dependencies": { "dependencies": {
"@vue/component-compiler-utils": "^2.4.0", "@vue/component-compiler-utils": "^2.4.0",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment