Open wesleyyee opened 4 years ago
Could you try to isolate what file this happened on? If you could make a git repo with a reduced usecase, that would be excellent.
Just to be sure that it isn’t related to your own dependencies, would you also try running this from outside your project? ie- instead of cd my-project
and npx react-codemod ...
, could you run `npx react-codemod my-project‘?
Ahh it seems to not like React.lazy
@threepointone https://github.com/wesleyyee/codeshift-react-lazy
Very helpful, thank you! I'll have a look this weekend.
@threepointone Did you ever solve this? I have a similar problem in a codemod I am writing where it chokes on the dynamic import.
Not using React.lazy, but same syntax with loadable:
const Dooby = loadable(
() => import('dooby/doo'),
{
fallback: <LoadingPage />
}
);
I'm not doing any active development on this, but I'd be happy to review and land a PR with a fix.
Hey, not sure if related, but also getting a similar error Error: did not recognize object of type "ChainExpression"
with the same stack trace when running rename-unsafe-lifecycles
@sterlu I had the same ChainExpression
error when running over our large non-TS codebase - it seems to choke on optional chaining operators ?.
.
By telling the codemod to treat the code as Typescript it worked though.
try npx react-codemod rename-unsafe-lifecycles
it'll work
Seeing this error when running rename-unsafe-lifecycles: