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)
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);
"grunt": "1.0.3"
"ts-loader": "5.2.1"
"webpack": "4.20.2"
"grunt-webpack": "3.1.3"
Can you replicate it using this repo? https://github.com/TypeStrong/ts-loader/tree/master/examples/fork-ts-checker-webpack-plugin
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:
Most helpful comment
FYI: version 0.5.2 works perfectly