Skip to content

fallback page accesses __data.json with a relative URL and fails #10733

@hybridherbst

Description

@hybridherbst

Describe the bug

According to #10730 fallback URLs need to access everything by absolute path which makes sense.
According to #9343 (comment) data is passed to +error.svelte from all previous loads.

However, that data is currently loaded from a relative URL, so passing the data fails in a build. I think it would need to be an absolute URL.

Reproduction

https://stackblitz.com/edit/sveltejs-kit-template-default-fb5xvp?file=svelte.config.js

npm run build
npm run preview (uses serve package on the build folder)

Logs

sveltejskittemplatedefaultfb5x-vqmp--3000--5291dfc1.local-credentialless.webcontainer.io/my/test/page/__data.json?x-sveltekit-invalidated=1:1     Failed to load resource: the server responded with a status of 404 (Not Found)

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.20.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.4.2 - /usr/local/bin/npm
    pnpm: 8.6.10 - /usr/local/bin/pnpm
  npmPackages:
    @sveltejs/adapter-static: ^2.0.3 => 2.0.3 
    @sveltejs/kit: ^1.20.4 => 1.25.0 
    svelte: ^4.0.5 => 4.2.0 
    vite: ^4.4.2 => 4.4.9

Severity

blocking usage of SvelteKit error pages

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions