question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

We now have the ssr: false option which gives us something close to SPA mode: https://kit.svelte.dev/docs#ssr-and-javascript

It doesn’t get us all the way there though, because in a typical SPA you would likely want to generate a single fallback page that handles all requests — for example Surge lets you add a 200.html file, while Netlify allows you to add something like this to _redirects:

/*    /200.html   200

By contrast, SvelteKit expects to generate (whether at runtime or prerender time) an HTML page that includes no content, but does include information about the route that should be hydrated, since the router isn’t invoked on load. To create a true SPA, SvelteKit needs to create a content-less file that doesn’t contain any route information, and the router needs to figure out what JS to load and execute.

I’m not certain how best to do this in a provider-agnostic way.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:81
  • Comments:40 (26 by maintainers)

github_iconTop GitHub Comments

44reactions
plunkettscottcommented, Apr 13, 2021

I know maintainers hate comments like, “I have this problem too”, but I couldn’t resist explaining why this is a very important use case for us.

We build self-contained apps using Go and when releasing versions of these apps we embed the files to be served from the binary’s embedded file system. Lacking a true SPA mode is what’s keeping us from exploring SvelteKit for these sort of deployment scenarios. When we embed the frontend app files, the client has to handle all routing because there is no SSR component.

As an alternative to having an SPA mode we’ve experimented with SSR using things like v8 bindings in Go but have found that the overhead isn’t worth the gain for the purpose of the application, especially since SEO isn’t a concern.

41reactions
Rich-Harriscommented, Apr 23, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Sveltekit (SPA mode) vs Routify : r/sveltejs - Reddit
I just came here to post something similar. For those of us writing a true SPA application, where the backend isn't even written...
Read more >
Single Page Application (SPA) Mode Guide - Infinity.co
SPA Mode puts you (and your application) in more control of what happens, and when, rather than our library performing tasks based on...
Read more >
The mode Property - Nuxt
The mode property. Change default nuxt mode. Type: string. Default: universal; Possible values: 'spa' : No server-side rendering (only client-side ...
Read more >
Rich Harris na Twitter: "over the weekend we added an oft ...
over the weekend we added an oft-requested feature to the SvelteKit beta: SPA mode, aka 'no SSR, please' : https://kit.svelte.dev/docs#ssr-and-javascript…
Read more >
Single-page application - Wikipedia
A single-page application (SPA) is a web application or website that interacts with the user by dynamically rewriting the current web page with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Hashnode Post

No results found