Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7275ae4

Browse filesBrowse files
clarkdohaoqunjiang
authored andcommitted
feat: support webpack 5 hooks (#1469)
1 parent d7024d1 commit 7275ae4
Copy full SHA for 7275ae4

File tree

Expand file treeCollapse file tree

2 files changed

+9
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-2
lines changed

‎lib/plugin.js

Copy file name to clipboardExpand all lines: lib/plugin.js
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@ class VueLoaderPlugin {
1010
if (compiler.hooks) {
1111
// webpack 4
1212
compiler.hooks.compilation.tap(id, compilation => {
13-
compilation.hooks.normalModuleLoader.tap(id, loaderContext => {
13+
let normalModuleLoader
14+
if (Object.isFrozen(compilation.hooks)) {
15+
// webpack 5
16+
normalModuleLoader = require('webpack/lib/NormalModule').getCompilationHooks(compilation).loader
17+
} else {
18+
normalModuleLoader = compilation.hooks.normalModuleLoader
19+
}
20+
normalModuleLoader.tap(id, loaderContext => {
1421
loaderContext[NS] = true
1522
})
1623
})

‎package.json

Copy file name to clipboardExpand all lines: package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
},
3535
"peerDependencies": {
3636
"css-loader": "*",
37-
"webpack": "^4.1.0"
37+
"webpack": "^4.1.0 || ^5.0.0-0"
3838
},
3939
"dependencies": {
4040
"@vue/component-compiler-utils": "^2.4.0",

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.