We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
process.env
In dev mode, process.env is provided in main thread but not worker.
In production mode, process.env is replaced by define plugin.
Actually there is no description about process.env in the docs. Some libraries use process.env and the behavior mismatches with each case.
https://github.com/buffaybu/vite-env-example
During yarn dev, process in worker is undefined and accessing process.env will throw an error.
yarn dev
process
undefined
After yarn build, process.env is replaced with static value and no error will be thrown.
yarn build
vite
The text was updated successfully, but these errors were encountered:
feat(dev): inject env for webworker
083922a
close vitejs#1838
feat(dev): inject env for webworker (#1846)
5735692
close #1838
Successfully merging a pull request may close this issue.
Describe the bug
In dev mode,
process.env
is provided in main thread but not worker.In production mode,
process.env
is replaced by define plugin.Actually there is no description about
process.env
in the docs. Some libraries useprocess.env
and the behavior mismatches with each case.Reproduction
https://github.com/buffaybu/vite-env-example
During
yarn dev
,process
in worker isundefined
and accessingprocess.env
will throw an error.After
yarn build
,process.env
is replaced with static value and no error will be thrown.System Info
vite
version: 2.0.0-beta.50The text was updated successfully, but these errors were encountered: