mrodal / vue-inheritance-loader

Webpack loader to be used along with vue-loader for Single File Components that provides template extension
38 stars 5 forks source link

Cannot read property 'options' of undefined #7

Closed FernandoFranco closed 5 years ago

FernandoFranco commented 5 years ago

I get "Unable to read property 'options' of undefined" src / index.js on line 26. this._compiler for some reason is not present, but not enough to tell why

Apparently a simple condition solves, but I don't know what consequences it could bring. let aliases = (this._compiler && this._compiler.options.resolve.alias) || null;

mrodal commented 5 years ago

which webpack version are you using?

FernandoFranco commented 5 years ago

according to yarnlock

"@vue/cli-plugin-babel@^3.0.5":
  version "3.12.1"
  resolved "https://registry.yarnpkg.com/@vue/cli-plugin-babel/-/cli-plugin-babel-3.12.1.tgz#9a79159de8cd086b013fa6d78a39830b2e2ec706"
  integrity sha512-Zetvz8PikLCGomeKOKu8pC9YQ7cfxs7pGpvEOzaxGdhMnebhjAYR6i6dOB57A6N5lhxQksXCtYTv26QgfiIpdg==
  dependencies:
    "@babel/core" "^7.0.0"
    "@vue/babel-preset-app" "^3.12.1"
    "@vue/cli-shared-utils" "^3.12.1"
    babel-loader "^8.0.5"
    webpack "^4.0.0"

exactly "4.41.2" in node_modules

FernandoFranco commented 5 years ago

Sorry, at line 26, I changed it back to: let aliases = (this._compiler && this._compiler.options.resolve.alias) || {};

So I get no errors consuming aliases when trying to retrieve ['__fromJest'].

mrodal commented 5 years ago

Hmm.. its weird.. could you upload a minimal example showing this error?

FernandoFranco commented 5 years ago

Currently the project containing the loader is commercial, and I don't have permissions to expose the code. But I will try to create another project that simulates the same problem as soon as possible.

FernandoFranco commented 5 years ago

Sorry for the delay. vue-inheritance-loader-issue.

I use yarn. To get the error, run: yarn build --mode production

jtyuan commented 5 years ago

Same issue happened to me for versions >= 0.1.8

mrodal commented 5 years ago

@FernandoFranco Sorry, I can't reproduce the issue. I downloaded your repo, ran yarn and then yarn build --mode production and it built without issues :\

If you do these same steps you get the error?

FernandoFranco commented 5 years ago

Curious, when I push, this sequence of commands threw the error. But I did the same today to check and did not give ...

mrodal commented 5 years ago

Ok, maybe it was the older version as @jtyuan said, Im closing for now, if it happens again please comment and I'll reopen

MatthewBooth commented 4 years ago

I'm getting this error today when doing a production build. Seems to be the same location and when run via a CI pipeline. A dev build is working fine.

I'm using Webpack 4 and version 0.1.9

MatthewBooth commented 4 years ago

I'll start a new issue. I think this is fixed by someone else. I'll know shortly