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

React Contentful not building with VITE #250

Open
bondia opened this issue Jul 18, 2022 · 0 comments
Open

React Contentful not building with VITE #250

bondia opened this issue Jul 18, 2022 · 0 comments

Comments

@bondia
Copy link

bondia commented Jul 18, 2022

I moved an old project that uses "react-contenful" to use Vite instead of Webpack.
On dev mode it runs OK but when building "react-contentful" it fails on the browser.

index.4dc67e6f.js:41 Uncaught ReferenceError: require is not defined

Screenshot 2022-07-18 at 08 59 11

The problem is that it is using require in client side.

const { createClient } = require('contentful');

Might be that it needs an import instead?
Any idea what is the underlying issue here?

Thanks a lot!

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

1 participant