Skip to content

Ability to disable hydration and client routing on error pages #1942

@GrygrFlzr

Description

@GrygrFlzr

Describe the problem

Currently, it is not possible to disable hydration and client routing for error pages. Error pages are arguably one of the best candidates for 0kB JS delivery when SSR'd, because in many cases they do not need to include any JS-powered interactivity.

This very basic error page on a fresh kit install:

<script context="module">
  export const load = ({ status, error }) => ({
    props: { status, error },
  });
</script>
<script>
  export let error;
  export let status;
</script>
<h1>{status}</h1>
<h2>{error.message}</h2>
<pre>{error.stack}</pre>

In production mode using adapter-node takes nearly 8 seconds to load on simulated Slow 3G, with a small data URI favicon embedded into app.html to prevent a favicon request. On 6x CPU slowdown on my computer it takes over 700ms to process the useless clientside JS. 11.4 kB of the total 12.8 kB transferred was for JS alone.

Describe the proposed solution

SvelteKit should respect the hydrate and router exports of the __error.svelte page.

Alternatives considered

Since __error.svelte is a core part of kit, there's not really a good user alternative.

Importance

Depends on usage - could be critical in particular regions of the world.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp2-nice-to-haveSvelteKit cannot be used by a small number of people, quality of life improvements, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions