-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Incorrect define replacement in build #8663
Labels
Comments
Closed
7 tasks
9 tasks
julienv3
added a commit
to julienv3/vite
that referenced
this issue
Nov 16, 2022
julienv3
added a commit
to julienv3/vite
that referenced
this issue
Nov 16, 2022
9 tasks
@tony19 it does not seem like #9791 fixes the issue. |
julienv3
added a commit
to julienv3/vite
that referenced
this issue
Nov 16, 2022
9 tasks
7 tasks
patak-dev
pushed a commit
that referenced
this issue
Dec 5, 2022
* fix: glob import parsing (#10949) (#11056) closes #10949 closes #11051 * fix: import.meta.env and process.env undefined variable replacement (fix #8663) (#10958) Co-authored-by: bluwy <bjornlu.dev@gmail.com> fix #8663 * fix(esbuild): handle inline sourcemap option (#11120) * fix(importGlob): preserve line count for sourcemap (#11122) * fix: Dev SSR dep optimization + respect optimizeDeps.include (#11123) * fix: reset global regex before match (#11132) * chore: fix test Co-authored-by: gtmnayan <50981692+gtm-nayan@users.noreply.github.com> Co-authored-by: julienv3 <julienv3@gmail.com> Co-authored-by: 翠 / green <green@sapphi.red>
futurGH
pushed a commit
to futurGH/vite
that referenced
this issue
Feb 26, 2023
vitejs#8663) (vitejs#10958) Co-authored-by: bluwy <bjornlu.dev@gmail.com> fix vitejs#8663
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the bug
When building a project that uses
import.meta.env.UNKNOWN
, it is being replaced asMODE:"production",DEV:!1,PROD:!0}.UNKNOWN
instead of({}).UNKNOWN
.Ref #8090 (Additional context)
Bug introduced in #5972 in Vite 3. Line 50 is never being used, and skips to line 51 instead.
vite/packages/vite/src/node/plugins/define.ts
Lines 42 to 53 in 908c9e4
This not only happens for
import.meta.env.
, butprocess.env.
to for ssr builds. And other similar usage.Reproduction
Vite 3: https://stackblitz.com/edit/vitejs-vite-b1md2x?file=main.js&terminal=build,preview
Vite 2.9: https://stackblitz.com/edit/vitejs-vite-ouwh65?file=main.js&terminal=build,preview
System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: