Skip to content
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

process.env is not provided in worker in dev mode #1838

Closed
buffaybu opened this issue Feb 2, 2021 · 0 comments · Fixed by #1846
Closed

process.env is not provided in worker in dev mode #1838

buffaybu opened this issue Feb 2, 2021 · 0 comments · Fixed by #1846

Comments

@buffaybu
Copy link
Contributor

buffaybu commented Feb 2, 2021

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 use process.env and the behavior mismatches with each case.

Reproduction

https://github.com/buffaybu/vite-env-example

During yarn dev, process in worker is undefined and accessing process.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.50
  • Operating System: macOS 11.1
  • Node version: 14.15.0
  • Package manager (npm/yarn/pnpm) and version: yarn
underfin added a commit to rolldown/vite that referenced this issue Feb 2, 2021
yyx990803 pushed a commit that referenced this issue Feb 2, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant