Element type is invalid. React third party lib with class component. #748
Replies: 3 comments
-
Ah interesting. That tracks that we’d have trouble resolving some deep imports properly. Trying to upconvert React’s old CommonJS to ESM comes with some difficulty. Maybe we should add that plugin to |
Beta Was this translation helpful? Give feedback.
-
Could you advise how to configure the plugin with snowpack v3? |
Beta Was this translation helpful? Give feedback.
-
Got the same problem when using |
Beta Was this translation helpful? Give feedback.
-
Issue when importing class components (that includes _createClass(... )) from third party library (processed by babel / rollup).
Functional components are imported ok.
Browser console:
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Thoughts (not tested):
it may relate to esbuild params in snowpack
It may be fixed by applying
https://www.npmjs.com/package/babel-plugin-transform-react-class-to-function
here
installOptions: { rollup: { plugins: [require('')()] } }
Beta Was this translation helpful? Give feedback.
All reactions