UnrefinedBrain/vue-metamorph

did not recognize object of type true on createNamedImport

Closed this issue · 2 comments

Use method createNamedImport failed with error "did not recognize object of type true" when attempt to create new name import when targeted import does not exist on file.

work fine only if targeted import already exist on file.

trace:

Error: did not recognize object of type true
at Object.getFieldNames (/project/node_modules/vue-metamorph/node_modules/ast-types/lib/types.js:660:19)
at visitChildren (/project/node_modules/vue-metamorph/node_modules/ast-types/lib/path-visitor.js:184:36)
at PVp.visitWithoutReset (/projectnode_modules/vue-metamorph/node_modules/ast-types/lib/path-visitor.js:166:20)
at NodePath.each (/project/node_modules/vue-metamorph/node_modules/ast-types/lib/path.js:87:26)
at visitChildren (/project/node_modules/vue-metamorph/node_modules/ast-types/lib/path-visitor.js:178:18)
at PVp.visitWithoutReset (/project/node_modules/vue-metamorph/node_modules/ast-types/lib/path-visitor.js:166:20)
at visitChildren (/project/node_modules/vue-metamorph/node_modules/ast-types/lib/path-visitor.js:203:25)
at Context.traverse (/project/node_modules/vue-metamorph/node_modules/ast-types/lib/path-visitor.js:317:20)
at Context.visitNode (file:///project/node_modules/vue-metamorph/dist/main.js:446:21)
at Context.invokeVisitorMethod (/project/node_modules/vue-metamorph/node_modules/ast-types/lib/path-visitor.js:282:51)

I'm not able to repro this error with some simple test cases I tried. Can you share your codemod code?

You can close the issue, it's work fine after re-install the lib. I can not reproduce the error now.