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

Vite 3 - isProduction flipped to true in dev server after a production build #9057

Closed
7 tasks done
bholmesdev opened this issue Jul 12, 2022 · 2 comments · Fixed by #9066
Closed
7 tasks done

Vite 3 - isProduction flipped to true in dev server after a production build #9057

bholmesdev opened this issue Jul 12, 2022 · 2 comments · Fixed by #9066

Comments

@bholmesdev
Copy link
Contributor

Describe the bug

Our CI spins up a Vite dev server after running a production build. For some reason, plugins receive isProduction: true in their resolvedConfig, even when mode: 'development' is explicitly set in the dev server's inline config.

Reproduction

https://stackblitz.com/edit/github-u7wgc4?file=package.json

System Info

System:
    OS: macOS 12.2
    CPU: (8) x64 Apple M1 Pro
    Memory: 41.20 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.18.1 - ~/.volta/tools/image/node/14.18.1/bin/node
    Yarn: 1.22.17 - ~/.volta/tools/image/yarn/1.22.17/bin/yarn
    npm: 8.4.0 - ~/.volta/tools/image/npm/8.4.0/bin/npm
  Browsers:
    Chrome: 103.0.5060.114
    Firefox: 102.0.1
    Safari: 15.3
  npmPackages:
    vite: 3.0.0-beta.10 => 3.0.0-beta.10

Used Package Manager

pnpm

Logs

No response

Validations

@JoviDeCroock
Copy link
Contributor

JoviDeCroock commented Jul 12, 2022

Hmm, this seems to be caused by the NODE_ENV being hard-set to production when running build, setting this persists across runs. 😅

Can PR something but not entirely sure what the preferred way forward is, I understand setting the env-variable but personally I would avoid it, I guess alternatively a fix would be to reset it post-build to the original value or account for mode: dev explicitly.

@bholmesdev
Copy link
Contributor Author

@JoviDeCroock Worked out a PR with patak here! #9058
Seeing some nasty test runner issues though. Not sure what's going on there

@github-actions github-actions bot locked and limited conversation to collaborators Jul 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants