-
-
Notifications
You must be signed in to change notification settings - Fork 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
respect --mode
, and remove server
, prod
and mode
from $app/env
#5602
Conversation
🦋 Changeset detectedLatest commit: aa2faf3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
I think I found a bug in Vite: vitejs/vite#9203. Might be easiest to just use |
Given this is intentional in Vite, perhaps we want to revert the patch in this PR to stay consistent. |
I'm surprised it's intentional to be honest — to my mind, It does call the naming into question though. We currently have Frankly I think we should remove |
Opened a PR to this branch that removes those redundant values: #5614 |
* remove redundant env * changeset * add meatier description * huh, cant use those in comments, they get replaced dangerously
--mode
--mode
, and remove server
, prod
and mode
from $app/env
Late to the party, but this is because some cases you might want to have dev behavior builds. For example, a staging site where you get helpful dev errors locally before deploying to prod where you want to have errors captured via Sentry instead. With this change, we're blocking this usecase unless we use I think we should still align with Vite here even if it may sound confusing. Having SK and Vite contradicting would be more confusing for users, espeically that we're a Vite plugin, users are reading both SK and Vite docs. |
I never used But for mode, that is not just boolean and can have different values, I'm not sure with this PR. I agree with bluwy in this. |
I think there are three cases here:
The question is whether QA / staging should be categorized as dev or prod. Vite says dev and this PR says prod. It's quite ambiguous. It's really neither and the problem is we're trying to jam three values into two. I wonder if the solution isn't instead to define |
This mostly fixes #5573, but not quite. It fixesmode
butdev
/prod
is broken — for some reason, with--mode custom
,import.meta.env.DEV
istrue
even for the built app. I haven't been able to replicate this in a plain Vite app, so it seems we're doing something iffy.Closes #5573
The conflation of mode and command is unfortunate:
import.meta.env.DEV
should be true ifcommand === 'serve'
and vice versa. It should have nothing to do withmode
. I'm not sure if that's part of what's happening here.Slightly unrelated, but: looking at this stuff more closely, I'm inclined to remove
mode
from$app/env
— it's a Vite concept, not a SvelteKit one, and should probably be expressed asimport.meta.env.MODE
.Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. All changesets should bepatch
until SvelteKit 1.0