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

Getting Element type is invalid on prod build using vite #226

Open
af-arturoramirez opened this issue Dec 16, 2022 · 4 comments
Open

Getting Element type is invalid on prod build using vite #226

af-arturoramirez opened this issue Dec 16, 2022 · 4 comments

Comments

@af-arturoramirez
Copy link

When I run it locally (vite) it works as expected but once I deployed it to prod (using vercel) it is throwing this error:

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

<button type="button" onClick={() => setToggler(!toggler)}> Toggle Lightbox </button> <FsLightbox toggler={toggler} sources={[ "https://i.imgur.com/fsyrScY.jpg", "https://www.youtube.com/watch?v=3nQNiWdeH2Q", "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4", ]} />

@ydainna
Copy link

ydainna commented Dec 19, 2022

Hi! I have the same problem .... if someone managed to fix it and the solution it would be very cool thanks

@JasperDeLanghe
Copy link

Running into the same issue when using build scripts.
I'm suspecting it's to do with newer react versions, personally I'm on v18.0.0 where the issue is happening.

@andriibieriezhnoi
Copy link

as temporary fix for vite

import ReactFsLightbox from 'fslightbox-react';

const FsLightbox = ReactFsLightbox.default
  ? ReactFsLightbox.default
  : ReactFsLightbox;

then use <FsLightbox />

@madsongr
Copy link

madsongr commented Jul 10, 2023

as temporary fix for vite

import ReactFsLightbox from 'fslightbox-react';

const FsLightbox = ReactFsLightbox.default
  ? ReactFsLightbox.default
  : ReactFsLightbox;

then use <FsLightbox />

Hi, I tried using and it works but I get this message on vscode and when I try to build it:

Property 'default' does not exist on type 'typeof FsLightbox'.

What can I do now?

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