Vite react plugin not transforming process.env in library mode #261
-
I have an issue with vite and react. When I'm building against index.html everything works fine, but if I configure vite to build a JavaScript module then references to process.env.NODE_ENV get left in my code, causing exceptions at runtime. I know that the correct way is for the code to reference import.meta.env instead of process.env, and my working theory is that the vite-react-plugin normally takes care of this, but apparently not when building a library. (Is "library mode" the right thing to call it?)
Have you ever had this issue and how did you solve it? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This is an expected behavior: vitejs/vite#8090 |
Beta Was this translation helpful? Give feedback.
This is an expected behavior: vitejs/vite#8090
See this comment if you want to continue using this kind of outdating pattern: vitejs/vite#8090 (comment)