-
-
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
fix: only disallow dynamic env access when prerendering #11436
Merged
Merged
+59
−18
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
🦋 Changeset detectedLatest commit: 5ee7ce8 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 |
dummdidumm
approved these changes
Dec 21, 2023
benmccann
approved these changes
Dec 21, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for implementing this!
Merged
eltigerchino
pushed a commit
that referenced
this pull request
Jan 9, 2024
* only disallow dynamic env access when prerendering * changeset * add test * sigh --------- Co-authored-by: Rich Harris <[email protected]>
eltigerchino
added a commit
that referenced
this pull request
Jan 15, 2024
* add ability to copy server assets per route * changeset * fix test * fix doc * fix asset copying * change process dir when using vite preview * remove process.chdir from vite preview * include assets used by default error pages * fix doc link * better doc example * fix doc type * ok for real * add tests for vercel adapter * prettier * fix tests * fix types * more type fixes * try this * documentation * skip adapter-vercel tests if on node v20 * oopsie wrong PR * move server asset metadata resolving to function * update changesets * revert builder test fixes * fix lockfile * prettier * lint * fix vercel tsc errors * prepublish only * fix: avoid running load functions when prerendering if no server load function exists and SSR is off (#11405) * chore: upgrade eslint-plugin-unicorn (#11432) * Version Packages (#11420) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * chore(deps): update dependency worktop to v0.8.0-next.16 (#11437) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * i don't think we need this any more (#11439) Co-authored-by: Rich Harris <[email protected]> * fix: only disallow dynamic env access when prerendering (#11436) * only disallow dynamic env access when prerendering * changeset * add test * sigh --------- Co-authored-by: Rich Harris <[email protected]> * docs: fix links to sveltesociety.dev (#11441) * Version Packages (#11442) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * fix: set ESLint config type to `Config` instead of `FlatConfig` (#11453) * Version Packages (#11457) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * fix: improve warning when encountering import.meta.env (#11440) * empty commit (#11469) Co-authored-by: Rich Harris <[email protected]> * fix form actions docs (#11470) Co-authored-by: Rich Harris <[email protected]> * Version Packages (#11468) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * chore(deps): update pnpm to v8.13.1 (#11471) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * docs: add performance page (#11424) * docs: add performance page * address minor feedback issues * lazy loading and waterfalls * prefetching * Apply suggestions from code review * Apply suggestions from code review * various * tweak * MDN page says nothing about lazy-loading videos * fix link * Update documentation/docs/40-best-practices/05-performance.md Co-authored-by: Ben McCann <[email protected]> * move images page * Update documentation/docs/40-best-practices/05-performance.md Co-authored-by: Ben McCann <[email protected]> * update font section (no point mentioning font-display without a recommended value) * various tweaks --------- Co-authored-by: Rich Harris <[email protected]> Co-authored-by: Rich Harris <[email protected]> * chore(deps): update pnpm to v8.14.0 (#11504) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: use latest Azure adapter in adapter-auto (#11496) * fix: update @vercel/nft to 0.26.1 (#11508) * Version Packages (#11507) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * exclude universal nodes * include assets imported by server hooks * update adapter-vercel tests * fix tests * fix and add test for server hooks assets * update adapter-vercel test app packages * im gonna lose my mind * ignore hashes for filenames in tests * oops * fix tests? * revert adapter-vercel types fix * improve readability of route asset for loop * simplify file reading in serverless functions example --------- Co-authored-by: Ben McCann <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Rich Harris <[email protected]> Co-authored-by: Rich Harris <[email protected]> Co-authored-by: Geoff Rich <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In SvelteKit 2, we disallow access to
$env/dynamic/[public|private]
during prerendering so that you can't bake stale values into your app. We do it slightly overzealously, however — they are also disallowed during the analysis phase, which is an unnecessary restriction.This PR distinguishes between the two phases. It also bails out of prerendering early if no prerenderable routes were found during the analysis phase, meaning that if you're not prerendering anything it's safe to access dynamic env vars in (for example)
hooks.server.js
.Closes #11341, closes #11425.
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. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.