Skip to content

Commit

Permalink
fix: check for compiler.webpack existence
Browse files Browse the repository at this point in the history
It's only available since webpack 5.1
  • Loading branch information
sodatea committed May 11, 2021
1 parent f7ee30b commit 2472b2f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/plugin-webpack5.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ const ruleSetCompiler = new RuleSetCompiler([

class VueLoaderPlugin {
apply (compiler) {
const normalModule = compiler.webpack.NormalModule || require("webpack/lib/NormalModule")
const normalModule = compiler.webpack
? 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 = normalModule.getCompilationHooks(compilation).loader
Expand Down

0 comments on commit 2472b2f

Please sign in to comment.