Skip to content

TypeError: Cannot read property 'options' of undefined #267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JasonIsGithubbin opened this issue Apr 22, 2019 · 4 comments · Fixed by #299
Closed

TypeError: Cannot read property 'options' of undefined #267

JasonIsGithubbin opened this issue Apr 22, 2019 · 4 comments · Fixed by #299

Comments

@JasonIsGithubbin
Copy link

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"

@johnnyreilly
Copy link
Member

@phryneas
Copy link
Contributor

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?

@yacut
Copy link

yacut commented May 4, 2019

FYI: version 0.5.2 works perfectly

@piotr-oles
Copy link
Collaborator

🎉 This issue has been resolved in version 1.3.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

phryneas added a commit to phryneas/fork-ts-checker-webpack-plugin that referenced this issue Jun 13, 2019
phryneas added a commit to phryneas/fork-ts-checker-webpack-plugin that referenced this issue Jun 13, 2019
phryneas added a commit to phryneas/fork-ts-checker-webpack-plugin that referenced this issue Jun 13, 2019
phryneas added a commit to phryneas/fork-ts-checker-webpack-plugin that referenced this issue Jun 13, 2019
phryneas added a commit to phryneas/fork-ts-checker-webpack-plugin that referenced this issue Jun 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants