You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
firebase deploy not running vite build in prod mode #5564
Create a new vite react project
console.log(import.meta.env.DEV) in app.js npm run dev
console log return true npm run build npm run serve
console log return false firebase experiments:enable webframeworks firebase init hosting firebase deploy firebase serve
console log return true
[REQUIRED] Steps to reproduce
Create a new vite react project
console.log(import.meta.env.DEV) in app.js npm run dev
console log return true npm run build npm run serve
console log return false firebase experiments:enable webframeworks firebase init hosting firebase deploy firebase serve
console log return true
[REQUIRED] Expected behavior
console log should return false in a firebase build as it runs npm run build(vite build) and vite build builds in production mode by default
Activity
tanjunior commentedon Feb 28, 2023
found a work around by following https://vitejs.dev/guide/static-deploy.html#google-firebase
change
firebase.jsonhosting fromto
jamesdaniels commentedon Apr 12, 2023
We are forcing the Vite build to production, we will override NODE_ENV in a future release but this should be sufficient.
joelharkes commentedon Jun 10, 2023
@tanjunior there is no way to run HMR vite in the emulator hosting?
AlxVallecillo commentedon Sep 16, 2023
Thank you @tanjunior that worked just fine
mrchantey commentedon Jun 23, 2024
I'm still getting dev environment variables when deploying a simple astro project with
firebase deployinfirebase-tools 13.11.2:Interestingly the only env that seems to be correct is
import.meta.env.MODE.The static deploy
firebase.jsonsolution won't work for SSR apps using frameworks.