mirror of
https://github.com/withastro/astro.git
synced 2025-01-06 22:10:10 -05:00
a5f1682347
* feat: add experimental client prerender * Update packages/astro/src/@types/astro.ts Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * docs: add more details about effects of the feature * add changeset * add tests * edit jsdoc and changeset with suggestions * Update packages/astro/src/@types/astro.ts Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com> * Update packages/astro/src/prefetch/index.ts Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com> * Update .changeset/sixty-dogs-sneeze.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Update packages/astro/src/@types/astro.ts Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Update .changeset/sixty-dogs-sneeze.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Update .changeset/sixty-dogs-sneeze.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Update packages/astro/src/@types/astro.ts Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> --------- Co-authored-by: Emanuele Stoppa <my.burning@gmail.com> Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
973 B
973 B
astro |
---|
minor |
Adds an experimental flag clientPrerender
to prerender your prefetched pages on the client with the Speculation Rules API.
// astro.config.mjs
{
prefetch: {
prefetchAll: true,
defaultStrategy: 'viewport',
},
experimental: {
clientPrerender: true,
},
}
Enabling this feature overrides the default prefetch
behavior globally to prerender links on the client according to your prefetch
configuration. Instead of appending a <link>
tag to the head of the document or fetching the page with JavaScript, a <script>
tag will be appended with the corresponding speculation rules.
Client side prerendering requires browser support. If the Speculation Rules API is not supported, prefetch
will fallback to the supported strategy.
See the Prefetch Guide for more prefetch
options and usage.