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

TypeError: Cannot read property 'value' of undefined #20

Open
bachvo opened this issue Aug 27, 2020 · 2 comments
Open

TypeError: Cannot read property 'value' of undefined #20

bachvo opened this issue Aug 27, 2020 · 2 comments

Comments

@bachvo
Copy link

bachvo commented Aug 27, 2020

When migrating an Ember engine, I came across this error:
TypeError: Cannot read property 'value' of undefined at ClassProperty (/home/bcvo/.npm/_npx/28538/lib/node_modules/ember-component-template-colocation-migrator/lib/utils/templates.js:22:42) at NodePath._call (/home/bcvo/.npm/_npx/28538/lib/node_modules/ember-component-template-colocation-migrator/node_modules/@babel/traverse/lib/path/context.js:55:20) at NodePath.call (/home/bcvo/.npm/_npx/28538/lib/node_modules/ember-component-template-colocation-migrator/node_modules/@babel/traverse/lib/path/context.js:42:17) at NodePath.visit (/home/bcvo/.npm/_npx/28538/lib/node_modules/ember-component-template-colocation-migrator/node_modules/@babel/traverse/lib/path/context.js:92:31) at TraversalContext.visitQueue (/home/bcvo/.npm/_npx/28538/lib/node_modules/ember-component-template-colocation-migrator/node_modules/@babel/traverse/lib/context.js:112:16) at TraversalContext.visitMultiple (/home/bcvo/.npm/_npx/28538/lib/node_modules/ember-component-template-colocation-migrator/node_modules/@babel/traverse/lib/context.js:79:17) at TraversalContext.visit (/home/bcvo/.npm/_npx/28538/lib/node_modules/ember-component-template-colocation-migrator/node_modules/@babel/traverse/lib/context.js:138:19) at Function.traverse.node (/home/bcvo/.npm/_npx/28538/lib/node_modules/ember-component-template-colocation-migrator/node_modules/@babel/traverse/lib/index.js:82:17) at NodePath.visit (/home/bcvo/.npm/_npx/28538/lib/node_modules/ember-component-template-colocation-migrator/node_modules/@babel/traverse/lib/path/context.js:99:18) at TraversalContext.visitQueue (/home/bcvo/.npm/_npx/28538/lib/node_modules/ember-component-template-colocation-migrator/node_modules/@babel/traverse/lib/context.js:112:16)

I took a look inside utils/templates.js where it was breaking and found that the issue is that one of my components had the layoutName property and it was failing the execution because of this.

It would be great to maybe surface this error in the console and making it clear to the developer that there is a component that has a reference to layoutName and they should change this before running another execution. Or maybe even handle this automatically as part of the codemod execution if it's possible.

@rwjblue
Copy link
Member

rwjblue commented Oct 19, 2020

Totally agree! Thanks for reporting!

Can you provide a code snippet for the component that had an issue? At the very least we should make the error better, but I suspect that we can also just "do the right thing".

Also, can you double check and confirm which version you were using?

@bachvo
Copy link
Author

bachvo commented Nov 14, 2020

It was a while ago so I'm not exactly sure what the component looked like, but i'm guessing it was something like this.
export default Component.extend({ layoutName='some_layout_name' });

Also not really sure the version of the codemod I was using at that time 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants