Element type is invalid in Next.js

I have been working with Rescript + Next.js for a couple of years without problems. Yesterday I upgraded Next.js and tried to implement BabelJS but then I noticed that the Rescript components started having issues with Next:

I rolledback all the dependencies but the problem persists. I isolated parts of the Rescript component until I found out that Next Image component is causing the problem when I use it in Rescript, but only for a specific image source that renders fine without Rescript. Then I also started seeing other many problems with react-three-fiber bindings. So I mini-freaked out.

I am curious if anyone else has seen a similar issue.

Resolved!

I was using .mjs for rescript and switched back to .bs.js

it is weird that mis was working before until I started fidgeting with tsconfig and babelrc. After that I couldn’t roll back.

Happy that bs.js works

1 Like