Skip to content

Single output apps with remote form functions throw an error #14120

@eltigerchino

Description

@eltigerchino

Describe the bug

Using the form remote function in an app configured with output: 'single' throws an error when starting the app. This is probably due to the bundling process changing the order of execution, causing the form() function to run before the remote_responses export is initialised by the client-side start() script.

!started ? (remote_responses[create_remote_cache_key(action, '')] ?? undefined) : undefined

remote_responses = hydrate?.remote ?? {};

Reproduction

  1. Build the app with npm run build
  2. Preview the app with npm run preview
  3. Open the browser inspector to see the error in the console logs.

https://stackblitz.com/~/github.com/eltigerchino/sveltejs-kit-template-default-s4qmymdn

Logs

Uncaught (in promise) TypeError: can't access property "?/remote=1ptltty%2Fexample/", Qa is undefined
    Immutable 3
        n
        Pl
        <anonymous>
bundle.B60k9xAt.js:4:6561

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: 20.19.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.8.2 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    @sveltejs/adapter-auto: ^6.0.0 => 6.0.1 
    @sveltejs/kit: ^2.22.0 => 2.27.0 
    @sveltejs/vite-plugin-svelte: ^6.0.0 => 6.1.0 
    svelte: ^5.25.0 => 5.37.3 
    vite: ^7.0.4 => 7.0.6

Severity

blocking an upgrade

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions