test: assert that pages don't embed env when dynamic public env vars are unused - #16306
Conversation
|
Install the latest version of pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/7850e95ced127a4eab43a2d15228e3a2a9f5d1c9Open in Note This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed. |
|
|
Can you please rebase all of your PRs onto the |
|
Not a problem with some AI help, sorry for this! Thanks for the heads up. |
…v vars are unused
f2d2ddd to
7850e95
Compare
env from server-rendered pages when the client doesn't use dynamic public env vars383ccc2
into
sveltejs:version-3
closes #8946
The follow-up I promised in #16024, a few weeks late. Retargeting it onto
version-3turned it into a test, because the fix I wrote formainis already there. The env embed sits behind the sameclient.uses_env_dynamic_publiccheck that the$env/dynamic/publicbranch has used since #11277:What's left is the regression coverage. On kit 2 with
experimental.explicitEnvironmentVariablesenabled, every server-rendered page ships anenv: {}object the client can never read, since static values are inlined into the generated$app/env/publicmodule as literals. Rich said as much reviewing #15934, "rendered_envis what gets sent from the server to the client.staticvariables are already in the client".One assertion added to the existing options-2 prerender test, so version-3 can't regress into shipping the dead object again. Verified it passes on
version-3and that the same assertion fails onmainwithout the omitted fix.Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.Edits