Skip to content

CSS/JS asset paths doubled in __vite__mapDeps when using paths.relative: false with SvelteKit 2.65.0 + Vite 8 (Rolldown) #16039

Description

@leereamsnyder

Describe the bug

After upgrading from SvelteKit 2.64.0 to 2.65.0, the built client entry file (_app/immutable/entry/app.[hash].js) emits CSS and JS dependency paths in __vite__mapDeps as ./-prefixed relative paths:

"./_app/immutable/assets/Prose.BmvqhkXc.css"

When a browser loads that entry file from /_app/immutable/entry/, it resolves ./ relative to the file's directory, producing a doubled URL:

/_app/immutable/entry/_app/immutable/assets/Prose.BmvqhkXc.css

This causes 404s for every lazily-loaded CSS and JS chunk. The site fails to render after the initial HTML load.

Config in svelte.config.js:

paths: {
  relative: false,
}

What changed between 2.64.0 and 2.65.0:

In 2.64.0, SvelteKit set Vite's base config to the absolute base path (/ when paths.relative: false). Rolldown respects this and generates __vite__mapDeps entries without a ./ prefix, which the Vite runtime then prepends / to at runtime (via t = function(e) { return '/' + e }), producing correct absolute paths.

In 2.65.0, the code was changed to always use base: './' and instead rely on experimental.renderBuiltUrl returning { relative: false } to produce absolute paths per-asset. Rolldown does not appear to honor renderBuiltUrl for the __vite__mapDeps dependency array, so the paths remain relative to the ./ base — producing the doubled-URL bug.

Workaround: Pin @sveltejs/kit to 2.64.0.

Reproduction

https://github.com/leereamsnyder/sveltekit-2-dot-65-relative-paths-repro

Build with npm run build, then inspect _app/immutable/entry/app.[hash].js — search for ./_app/immutable/assets/ in the __vite__mapDeps array. Serve the build with npm run preview and open DevTools Network to observe 404s at the doubled paths.

Logs

GET /_app/immutable/entry/_app/immutable/assets/Prose.BmvqhkXc.css 404
GET /_app/immutable/entry/_app/immutable/chunks/CeONHeB4.js 404
A ServiceWorker intercepted the request and encountered an unexpected error.

System Info

System:
    OS: macOS 26.5.1
    CPU: (10) arm64 Apple M5
    Memory: 135.14 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.22.3 - /opt/homebrew/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.9.8 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 149.0.7827.104
    Safari: 26.5
  npmPackages:
    @sveltejs/adapter-cloudflare: 7.2.8
    @sveltejs/kit: 2.65.0   ← bug present; 2.64.0 = working
    @sveltejs/vite-plugin-svelte: 7.1.2
    svelte: 5.56.3
    vite: 8.0.16

Severity

blocking an upgrade

Additional Information

The specific change in SvelteKit between 2.64.0 and 2.65.0 is in src/exports/vite/index.js:

  • 2.64.0: const client_base = kit.paths.relative !== false || kit.paths.assets ? './' : kit_paths_base; — passes this as Vite's base, so Rolldown generates root-relative dep paths and the preload runtime prepends / correctly.
  • 2.65.0: base: './' is hardcoded; experimental.renderBuiltUrl returning { relative: false } is used instead — Rolldown does not respect this for the __vite__mapDeps array, leaving ./-relative paths in the output.

This may be a Rolldown limitation with experimental.renderBuiltUrl, but since 2.64.0 worked around it via the base config and 2.65.0 removed that workaround, the regression is observable at the SvelteKit level.

Activity

  1. tsushanth commented on Jun 13, 2026

    @tsushanth

    This regression was fixed yesterday in #16026 (commit 1f9bc7996, merged 2026-06-12). The fix restores the conditional base path that 2.64.0 used; the PR description notes that Vite's base setting controls the _app/immutable/entry/app.xxxx.js chunk paths and isn't influenced by experimental.renderBuiltUrl, which matches the diagnosis here. Building main against the linked repro returns the absolute-prefixed paths, so this should be resolved as soon as the next @sveltejs/kit release goes out.

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

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions