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.NODE_ENV not set to production #1445

Closed
2 of 3 tasks
RobbinBaauw opened this issue Jan 9, 2021 · 0 comments
Closed
2 of 3 tasks

process.env.NODE_ENV not set to production #1445

RobbinBaauw opened this issue Jan 9, 2021 · 0 comments

Comments

@RobbinBaauw
Copy link

RobbinBaauw commented Jan 9, 2021

  • Read the docs.
  • Use Vite >=2.0. (1.x is no longer supported)
  • If the issue is related to 1.x -> 2.0 upgrade, read the Migration Guide first.

Describe the bug

Plugins don't have the process.env.NODE_ENV variable set to production when building for production.

I came across this when my tailwindcss build was suddenly huge, since the purge plugin relies on process.env.NODE_ENV being set to production, whereas it was development since Vite 2.

Reproduction

  1. Clone https://github.com/RobbinBaauw/vite-process-repro
  2. yarn && yarn build
  3. Note the development in the logs

The only change I made w.r.t. the default template is adding a plugin:
https://github.com/RobbinBaauw/vite-process-repro/blob/1ef30c9230c79f43e7b69f2e95f6294e1aab9e26/vite.config.js#L6-L14

You'll also see logs of undefined, I'm not sure if that's an issue as well.

System Info

  • vite version: 2.0.0-beta.12
  • Operating System: Pop!_OS
  • Node version: node 12.18.1
  • Package manager (npm/yarn/pnpm) and version: yarn 1.22.4
underfin added a commit to rolldown/vite that referenced this issue Jan 9, 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.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants