Fork-ts-checker-webpack-plugin: TypeError: Cannot read property 'options' of undefined

Created on 22 Apr 2019  路  4Comments  路  Source: TypeStrong/fork-ts-checker-webpack-plugin

Current behavior

TypeError: Cannot read property 'options' of undefined
    at ForkTsCheckerWebpackPlugin.computeContextPath (node_modules/fork-ts-checker-webpack-plugin/lib/index.js:31:41)
    at ForkTsCheckerWebpackPlugin.instance.(anonymous function) [as computeContextPath] (node_modules/grunt-webpack/src/options/OptionHelper.js:88:35)
    at ForkTsCheckerWebpackPlugin.apply (node_modules/fork-ts-checker-webpack-plugin/lib/index.js:133:34)
    at webpack (node_modules/webpack/lib/webpack.js:47:13)

Steps to reproduce the issue

I am running webpack, using the basic config laid out in README.md, with grunt-webpack. The issue seems to be that this.compiler is not set here:

this.computeContextPath = (filePath) => path.isAbsolute(filePath)
? filePath
: path.resolve(this.compiler.options.context, filePath);

Environment

"grunt": "1.0.3"
"ts-loader": "5.2.1"
"webpack": "4.20.2"
"grunt-webpack": "3.1.3"

bug released

Most helpful comment

FYI: version 0.5.2 works perfectly

All 4 comments

From what I can see, this exact error could only occur if ForkTsCheckerWebpackPlugin.apply is called with undefined or no arguments.

This seems to be more of a bug with grunt-webpack or webpack itself, as usually webpack would call the apply method.

To further narrow it down, could you try turning the cache in your grunt-webpack configuration off?

FYI: version 0.5.2 works perfectly

:tada: This issue has been resolved in version 1.3.6 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

Was this page helpful?
0 / 5 - 0 ratings