Skip to content
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

Cannot read property 'findDeclaration' of undefined #1198

Closed
piotr-cz opened this issue Dec 29, 2016 · 7 comments · Fixed by #1204
Closed

Cannot read property 'findDeclaration' of undefined #1198

piotr-cz opened this issue Dec 29, 2016 · 7 comments · Fixed by #1204

Comments

@piotr-cz
Copy link

Since update to v0.38.2 I've started to receive following fatal error:
Cannot read property 'findDeclaration' of undefined.

Only thing I've been able to confrim is that the scope which is passed callHasEffects function is indeed undefined.

Issue persists in v0.38.3.

Stack trace TypeError: Cannot read property 'findDeclaration' of undefined at callHasEffects (xxx\node_modules\rollup\src\ast\nodes\shared\callHasEffects.js:75:29) at CallExpression.hasEffects (xxx\node_modules\rollup\src\ast\nodes\CallExpression.js:30:10) at CallExpression.isUsedByBundle (xxx\node_modules\rollup\src\ast\nodes\CallExpression.js:41:15) at xxx\node_modules\rollup\src\Bundle.js:161:31
@kzc
Copy link
Contributor

kzc commented Dec 29, 2016

Could you post a small javascript example that triggers this error?

@sunjay
Copy link

sunjay commented Dec 30, 2016

I'm also experiencing this problem. There was no error until I updated to the latest rollup. The stack trace also doesn't point to any of my code so there is nothing I can provide to reproduce the problem without some more information from the rollup team about what to look for.

I'm using rollup v0.39.0

Cannot read property 'findDeclaration' of undefined
TypeError: Cannot read property 'findDeclaration' of undefined
    at callHasEffects (./node_modules/rollup/src/ast/nodes/shared/callHasEffects.js:75:29)
    at CallExpression.hasEffects (./node_modules/rollup/src/ast/nodes/CallExpression.js:34:10)
    at CallExpression.isUsedByBundle (./node_modules/rollup/src/ast/nodes/CallExpression.js:45:15)
    at ./node_modules/rollup/src/Bundle.js:162:31

@sunjay
Copy link

sunjay commented Dec 30, 2016

Rolling back to 0.38.1 fixes the problem for the time being. That means something something happened between 0.38.1 and 0.38.2 to cause this.

@yamafaktory
Copy link

Hi, I am also experiencing the same issue after a Greenkeeper PR. You can check it here: yamafaktory/buble-react-rollup-starter#8.

@kzc
Copy link
Contributor

kzc commented Dec 30, 2016

Repro thanks to @yamafaktory

Adapted from react-dom/lib/validateDOMNesting.js in production mode:

rollup version 0.39.0

$ cat repro.js

if (0) {
    var inScopeTags = [];
    var buttonScopeTags = inScopeTags.concat(['button']);
}

$ node bin/rollup repro.js

Cannot read property 'findDeclaration' of undefined

Regression introduced in commit b287370

@piotr-cz
Copy link
Author

piotr-cz commented Dec 30, 2016

I'm using react and react-dom as well and AFAIK error pops up only in production mode.
It might indeed be b287370 because it was merged into v0.38.2

Rich-Harris added a commit that referenced this issue Dec 30, 2016
ignore var inits in dead branches
@Rich-Harris
Copy link
Contributor

Thanks all – fixed in 0.39.1

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