Uncaught ReferenceError: process is not defined #8189
-
I am getting the error message 'Uncaught ReferenceError: process is not defined' when using a React Spectrum tooltip component. The console reports that the error is thrown by localhost:5173/node_modules/.vite/deps/@adobe_react-spectrum.js?v=4947d2b2 This is the minimal code that reproduces the error. When you hover over the button, the error is thrown after a short delay (i.e. when the tooltip would normally appear).
The environment is:
I am hoping that I have made a mistake somewhere or that there is a simple fix, but I cannot find any similar reports in any forum. Can anyone help? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Have you followed advice here? vitejs/vite#2278 |
Beta Was this translation helpful? Give feedback.
-
Hi Robert There was no change in the error message. I have uploaded the test app to Github: https://github.com/cj3241/spectrum-eval Thanks again for your help with this |
Beta Was this translation helpful? Give feedback.
I'm not sure why they do it so differently and I still don't know how React manages to work with it in their source. But you don't need the
replace
module.Instead, just add this to your vite.config.ts
https://vite.dev/config/shared-options.html#define
You could change the keys in it depending on what you're doing. For instance you could use
mode
https://vite.dev/config/#conditional-config in here to set NODE_ENV to production or dev so that you get our new warning and error messages when you're developing but you don't need to worry about them in your production build.