Unexpected string when using globalThis.process.env.NODE_ENV
#12185
Labels
p3-minor-bug
An edge case that only affects very specific usage (priority)
Describe the bug
Running
vite dev
substitutesglobalThis.process.env.NODE_ENV
intoglobalThis."development"
. This causes console errorSyntaxError: Unexpected string
. This kind of code is usually in some dependency and can not be easily replaced.It looks like this is a known problem but I have not found any issue reported here nor in documentation how it can be solved. Here is one potential "workaround" https://github.com/DougAnderson444/ipfs-vite-svelte-kit#processenvnode_env-in-svelte-dev
Reproduction
https://stackblitz.com/edit/vitejs-vite-kfsmj6?file=counter.js
Steps to reproduce
Just use
globalThis.process.env.NODE_ENV
somewhere in code and runvite dev
System Info
Used Package Manager
npm
Logs
Validations
The text was updated successfully, but these errors were encountered: