Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Errors with Vite #68

Open
edbella opened this issue Jan 6, 2023 · 5 comments
Open

Build Errors with Vite #68

edbella opened this issue Jan 6, 2023 · 5 comments

Comments

@edbella
Copy link

edbella commented Jan 6, 2023

@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.

@GiorgioBertolotti
Copy link

I am facing the same error, could you take a look? @fseehawer

@fseehawer
Copy link
Owner

fseehawer commented Feb 16, 2023

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.

@nicvickeryw
Copy link

nicvickeryw commented Jun 2, 2023

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);

@GiorgioBertolotti
Copy link

On my side the problem seems now to be fixed, even without using @nicvickeryw's workaround 🙏🏼

@ParhamMoAsghari
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants