-
-
Notifications
You must be signed in to change notification settings - Fork 113
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 Carbon Components <CodeSnippet> Errors Out on Vite Production Build Only But Works on Dev #28
Comments
Root cause: Could be easily fixed in Rollup. |
…t is a class Fixes https://github.com/vitejs/vite/issues/10853 Since rollup@3c00191 the namespace became callable when requiring ESM with function default, but it isn't newable, leading to errors when the function is actually a class.
…1350) * fix: correctly wraps the default export from a CommonJS module when it is a class Fixes https://github.com/vitejs/vite/issues/10853 Since 3c00191 the namespace became callable when requiring ESM with function default, but it isn't newable, leading to errors when the function is actually a class. * test: update snapshots as the helper code has changed
Fixed in |
i'm using vite@v3, do we have an update in v3? |
Vite 4 contains very few breaking changes, so I recommend upgrading to it if possible. If not, you can open a PR in the Vite repository to backport the dependency upgrade to the |
Describe the bug
I am part of a team that has started work on a preexisting React/Vite project that uses Carbon Components. All is well until Docker serves Nginx with a production build and the component produces the following error:
This is even while just trying to render a simple string:
The strange thing is that this only seems to affect the component and none of the other Carbon Components I have on the page. I've made a simple reproduction in StackBlitz as closely as I could without running it through Docker and Nginx. Running a Vite Build and then Vite Preview sometimes it seems to work but other times is doesn't render to the screen at all but without any errors.
vite.config.ts
package.json
Reproduction
https://stackblitz.com/edit/vitejs-vite-cygruj?file=package.json,vite.config.ts,src%2Fmain.tsx,index.html,src%2FApp.tsx&terminal=dev
Steps to reproduce
vite build
vite preview
System Info
Used Package Manager
yarn
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: