You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ESM import issue causing: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
#115
I have a project where I have used react-linkify successfully for several years. I'm currently upgrading this project to ESM (i.e. I'm putting "type": "module" into my own package.json file). I got most things in my app to work again using ESM but whenevert I open a page that renders a react linkify component I get this error:
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
I use the library like this:
import Linkify from 'react-linkify'
...
<Linkify>{comment}</Linkify>
If I print the Linkify like this: console.log('Linkify=', Linkify) it looks like this in the devtools:
I just to see if worked, I change the usage temporarily into <Linkify.default>{comment}</Linkify.default> and then it works.
However, Linkify.default is ugly... any ideas isn't my import working normally? Is it some kind of ESM/CJS interop layer used in react-linkify that is getting it the way here?
Does react-linkify support being imported in ESM projects?
Note: many other libraries can be imported just fine, like for example:
@stripe/react-stripe-js, @sentry/browser, @stripe/stripe-js/pure.js, react-router, react
The text was updated successfully, but these errors were encountered:
I have a project where I have used react-linkify successfully for several years. I'm currently upgrading this project to ESM (i.e. I'm putting "type": "module" into my own package.json file). I got most things in my app to work again using ESM but whenevert I open a page that renders a react linkify component I get this error:
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
I use the library like this:
If I print the Linkify like this: console.log('Linkify=', Linkify) it looks like this in the devtools:
I just to see if worked, I change the usage temporarily into
<Linkify.default>{comment}</Linkify.default>
and then it works.However, Linkify.default is ugly... any ideas isn't my import working normally? Is it some kind of ESM/CJS interop layer used in react-linkify that is getting it the way here?
Does react-linkify support being imported in ESM projects?
Note: many other libraries can be imported just fine, like for example:
@stripe/react-stripe-js, @sentry/browser, @stripe/stripe-js/pure.js, react-router, react
The text was updated successfully, but these errors were encountered: