Skip to content

HMR breaks after client-side navigation when compilerOptions.experimental.async is enabled #14699

@yayza

Description

@yayza

Describe the bug

When compilerOptions.experimental.async: true is enabled in svelte.config.js, Hot Module Replacement (HMR) fails after client-side navigation. The page component content disappears from the DOM when editing the page's .svelte file. A full page refresh is required to restore functionality.

Reproduction

  1. Enable experimental async in svelte.config.js:
export default {
  compilerOptions: {
    experimental: {
      async: true,
    },
  },
};
  1. Start dev server and loading the page directly (works fine)
  2. Edit the page component - HMR works correctly
  3. Navigate to another page using client-side navigation
  4. Edit the page component - the page component content disappears
  5. Refresh the page - content reappears and HMR works again until next navigation

Logs

No logs...

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (24) x64 AMD Ryzen 9 9900X 12-Core Processor
    Memory: 8.00 GB / 31.08 GB
  Binaries:
    Node: 24.6.0 - C:\nvm4w\nodejs\node.EXE
    npm: 11.5.1 - C:\Users\admin\AppData\Local\pnpm\npm.CMD
    pnpm: 10.18.1 - C:\nvm4w\nodejs\pnpm.CMD
    Deno: 2.2.1 - C:\Users\admin\AppData\Local\Microsoft\WinGet\Packages\DenoLand.Deno_Microsoft.Winget.Source_8wekyb3d8bbwe\deno.EXE
  Browsers:
    Edge: Chromium (140.0.3485.54)
    Firefox Developer Edition: 144.0 - C:\Program Files\Firefox Developer Edition\firefox.exe
  npmPackages:
    @sveltejs/adapter-node: ^5.3.3 => 5.3.3
    @sveltejs/kit: ^2.46.4 => 2.46.4
    @sveltejs/vite-plugin-svelte: ^6.2.1 => 6.2.1
    svelte: ^5.39.11 => 5.39.11
    vite: ^7.1.9 => 7.1.9

Severity

annoyance

Additional Information

https://www.sveltelab.dev/4z1u30zw8n2tj87

Very similar issue: sveltejs/svelte#12403

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions