-
Notifications
You must be signed in to change notification settings - Fork 37
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
Problem with global
in prod build vite + React
#139
Comments
global
in prod build vite + React
@michalbujalski Have you tried adding the import nodePolyfills from "rollup-plugin-node-polyfills";
export default defineConfig({
// add the following to the rest of your config:
build: {
rollupOptions: {
plugins: [ nodePolyfills() as any],
}
}
}) |
Yes, I got the same result |
@michalbujalski Are you getting that error after running define: {
global: "globalThis",
}, Also, if you see any errors in the dev tools console about commonjsOptions: {
transformMixedEsModules: true,
}, |
any update on a fix |
I ran into a similar set of issues with a Vite+React application. A local build worked as expected but the same build deployed to Netlify would throw the following errors in the Chrome DevTools console:
Setting the
The node polyfills should fix the errors related to the 'not defined' global variables. |
I have vite+React setup. Everything works fine in development enviroment but when I run
![image](https://user-images.githubusercontent.com/716308/193692155-ec67f9ac-48a7-4715-84d5-05b01ac518a9.png)
yarn build
I get the following error:I've added a workaround to
vite.config.ts
:The text was updated successfully, but these errors were encountered: