Skip to content
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

ssr/router/hydrate options (SPA mode! 0kb JS pages!) #713

Merged
merged 10 commits into from
Mar 29, 2021
Merged

Conversation

Rich-Harris
Copy link
Member

See #231 (and also #570). I'm practicing readme-driven development by writing the docs first and worrying about the implementation later, so that folks can weigh in on the design straight away.

@vercel
Copy link

vercel bot commented Mar 26, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/sveltejs/kit/2DhQdZv2RGHVBapb7t4jsbHJ7X9T
✅ Preview: Canceled

[Deployment for 3de7061 canceled]

@Rich-Harris Rich-Harris changed the title documentation for ssr/router/hydrate (#231) documentation for ssr/router/hydrate Mar 26, 2021
@Rich-Harris
Copy link
Member Author

Ok, this is implemented. Kind of fun to add export const hydrate = false, router = false to a page and see it render without loading any JS whatsoever. Maybe one day we'll be able to determine that automatically through static analysis, but in the meantime 0kb JS is a nice selling point.

Just need to figure out if we want to make any tweaks to the API. (@benmccann I like the SSR-for-googlebot idea but I think we can work that out in a separate PR)

@Rich-Harris Rich-Harris changed the title documentation for ssr/router/hydrate ssr/router/hydrate options (0kb JS pages!) Mar 27, 2021
@Rich-Harris Rich-Harris changed the title ssr/router/hydrate options (0kb JS pages!) ssr/router/hydrate options (SPA mode! 0kb JS pages!) Mar 27, 2021
@benmccann benmccann linked an issue Mar 29, 2021 that may be closed by this pull request
@Rich-Harris Rich-Harris merged commit a59fbd0 into master Mar 29, 2021
@Rich-Harris Rich-Harris deleted the gh-231 branch March 29, 2021 16:08
@frederikhors
Copy link
Contributor

@Rich-Harris I do not know how to thank you! ❤️

@meigo
Copy link

meigo commented Apr 3, 2021

Is it certain it works?
On page setting

<script context="module">
  export const hydrate = false;
  export const router = false;
</script>

and still getting js in prerendered html

<link rel="modulepreload" href="/./_app/start-7d9b1f5f.js">
<link rel="modulepreload" href="/./_app/chunks/vendor-b2527fc7.js">
<link rel="modulepreload" href="/./_app/pages\index.svelte-1c557d65.js">
...

Both with node and static adapters.

@frederikhors
Copy link
Contributor

@meigo we are all waiting for it: #754!

@meigo
Copy link

meigo commented Apr 3, 2021

Oh, I see, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disable SSR (and CSR!)
8 participants