react-circular-slider
react-circular-slider copied to clipboard
Build Errors with Vite
@fabianbru Could you give pointers on the below?
I've tried to use this package a couple of times with Vite but it doesn't work. I believe it has to do with the way the package is compiled that makes it result in a post-build error React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.
I am facing the same error, could you take a look? @fseehawer
Hi @edbella and @GiorgioBertolotti, you are always welcome to create a PR if you encounter any issues and want to fix it yourself. I haven't run into the issue yet. I will try to reproduce it.
I've run into this issue too -- seems like a common interoperability issue with CJS modules (see here for more, I've had this same problem with other packages which this solution works for as well):
Here's my current workaround (to work with TS):
export function interopDefault(value: any): {
return value.default;
}
const CircularSlider =
import.meta.env['MODE'] === 'development' ? CircularSliderDev : interopDefault(CircularSliderDev);
On my side the problem seems now to be fixed, even without using @nicvickeryw's workaround 🙏🏼
I'm facing almost the same issue getting Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: [missing argument].[missing argument]
after build in vite ts react.
But no issue when developing.