Skip to content

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

Description

@bachvo

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions