Skip to content

since 2.21.3 navigating causes error in bundle.js and forces page reload #13868

Closed

Description

@timotejroiko

Describe the bug

Since installing 2.21.3 every navigation forces a page reload and shows this in the browser console:

bundle.CUuEHxTC.js:3 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'decoders')

inspecting the above file after prettifying it in dev tools points to this:

Ma(["click"]);
const Xd = De.decoders; // <-error here
function eg(e) {
    const r = JSON.parse(e);
    return r.data && (r.data = j_(r.data, Xd)),
    r
}

After playing around with configuration and adding/removing things, i was not able to determine exactly which part of the project triggers it, i simply decided to rollback to 2.21.2

Is this a known issue or is there any specific configuration group i should look into to try and find a root cause?

Also, the issue seems to happen only in production, it does not occur in dev mode.

Also, it seems client-side JS completely stopped functioning.

Reproduction

I was not able to determine exactly which part of my project causes it.

Logs

System Info

System:
    OS: Linux 6.1 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
    CPU: (2) x64 AMD EPYC Processor
    Memory: 845.43 MB / 1.87 GB
    Container: Yes
    Shell: 5.2.15 - /bin/bash
  Binaries:
    Node: 24.0.2 - ~/.nvm/versions/node/v24.0.2/bin/node
    npm: 11.3.0 - ~/.nvm/versions/node/v24.0.2/bin/npm
  npmPackages:
    @sveltejs/adapter-node: 5.2.12 => 5.2.12 
    @sveltejs/enhanced-img: 0.6.0 => 0.6.0 
    @sveltejs/kit: ^2.21.3 => 2.21.3 
    @sveltejs/vite-plugin-svelte: 5.1.0 => 5.1.0 
    svelte: 5.33.18 => 5.33.18 
    vite: 6.3.5 => 6.3.5

Severity

blocking an upgrade

Additional Information

No response

Activity

  1. kposborne commented on Jun 9, 2025

    @kposborne

    I run unit tests with jsdom, they started failing with this error upon attempting to upgrade to 2.21.3. Based on the error message, it looks related to this change: #13686

    TypeError: Cannot read properties of undefined (reading 'decoders')
     ❯ node_modules/@sveltejs/kit/src/runtime/app/forms.js:9:39
          7| export { applyAction };
          8| 
          9| const decoders = BROWSER ? client_app.decoders : server_app?.decoders;
           |                                       ^
         10| 
         11| /**
     ❯ node_modules/sveltekit-superforms/dist/client/superForm.js:11:1
    
  2. bigmac44 commented on Jun 10, 2025

    @bigmac44

    I run unit tests with jsdom, they started failing with this error upon attempting to upgrade to 2.21.3. Based on the error message, it looks related to this change: #13686

    Same error with vitest browser tests. Error with 2.21.3 but not 2.21.2.

  3. added theissue type on Jun 10, 2025
  4. teemingc commented on Jun 10, 2025

    @teemingc
    Member

    Managed to reproduce this. The conditions are building an single/inline output app which causes app to not get initialised before the following statement is evaluated (as Elliot pointed out)

    const decoders = BROWSER ? client_app.decoders : server_app?.decoders;

    Fortunately, we can move this away from the top-level and it still gets tree-shaken for server/client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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