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
feat: statically analyse universal pages and layouts v3 (#13684)
* wip
* try lazily loading the universal module
* generate types
* identify csr only nodes
* remove unused options
* better name
* analyse once
* format
* generate types
* windows
* add test
* fix root layout not being considered
* changeset
* named import
* add todo
* docs
* lazily compute page options during dev
* format
* remove server component removal
* Update documentation/docs/20-core-concepts/40-page-options.md
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
* correctly skip parsing
* format
* save
* todos
* allow let exports
* format
* name tests
* format
* Update documentation/docs/20-core-concepts/40-page-options.md
* add todos
* Update packages/kit/src/exports/vite/static_analysis/index.spec.js
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
* Update packages/kit/src/exports/vite/static_analysis/index.spec.js
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
* remove reassignment cases and fix dev change not reevaluating page options
* remove zimmerframe dep from kit
* add test for file updates
* run prettier
* done!
* format
---------
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
feat: allow running client-side code at the top-level of universal pages/layouts when SSR is disabled and page options are only boolean or string literals
Copy file name to clipboardExpand all lines: documentation/docs/20-core-concepts/40-page-options.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -127,7 +127,7 @@ export const ssr = false;
127
127
128
128
If you add `export const ssr = false` to your root `+layout.js`, your entire app will only be rendered on the client — which essentially means you turn your app into an SPA.
129
129
130
-
> [!NOTE]Even with `ssr` set to `false`, code that relies on browser APIs should be imported in your `+page.svelte` or `+layout.svelte` file instead. This is because page options can be overriden and need to be evaluated by importing your `+page.js` or `+layout.js` file on the server (if you have a runtime) or at build time (in case of prerendering).
130
+
> [!NOTE]If all your page options are boolean or string literal values, SvelteKit will evaluate them statically. If not, it will import your `+page.js` or `+layout.js` file on the server (both at build time, and at runtime if your app isn't fully static) so it can evaluate the options. In the second case, browser-only code must not run when the module is loaded. In practice, this means you should import browser-only code in your `+page.svelte` or `+layout.svelte` file instead.
0 commit comments