Skip to content

Commit e099d3b

Browse files
committed
fix: webpack object might be missing
1 parent e08cf7f commit e099d3b

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/plugin.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ export default class DocgenPlugin implements webpack.WebpackPluginInstance {
126126
const { exclude = [], include = ["**/**.tsx"] } = this.options;
127127
const isExcluded = matchGlob(exclude);
128128
const isIncluded = matchGlob(include);
129-
const webpackVersion = compiler.webpack.version;
129+
// Property compiler.version is set only starting from webpack 5
130+
const webpackVersion = compiler.webpack?.version;
130131
const isWebpack5 = parseInt(webpackVersion.split(".")[0], 10) >= 5;
131132

132133
compiler.hooks.compilation.tap(

0 commit comments

Comments
 (0)