Skip to content

[Bug]: Storybook fails when using async svelte #32281

@jhechtf

Description

@jhechtf

Describe the bug

Svelte just recently released the Async Svelte, allowing for usage of await in many places in Svelte components.

When trying to use Storybook in a project that is utilizing this feature, currently only available through an experimental compiler option, storybook breaks on every component, even the example ones storybook creates when initializing a project.

Reproduction link

https://github.com/jhechtf/storybook-svelte-5-repro

Reproduction steps

  1. Create a new svelte project with pnpx sv create, choose minimal and tailwindcss.
  2. Add in storybook with pnpx storybook@latest init
  3. Edit svelte.config.js to have the following compilerOptions
const config = {
  preprocess: vitePreprocess(),
  compilerOptions: {
    // Enable run-time checks when not in production
     experimental: {
       async: true,
     }
  },
  kit: {
    adapter: adapter({
      fallback: "index.html",
    }),
  },
};
export default config
  1. Try to run storybook with pnpm storybook. The page will open and you will find the following error
Image 5. Stop the storybook process, comment out the `experimental: ...` and re-run, and you will get the following Image

System

System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor
  Binaries:
    Node: 24.4.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 11.4.2 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.6.0 - C:\Program Files\nodejs\pnpm.CMD <----- active
  Browsers:
    Chrome: 139.0.7258.128
    Edge: Chromium (139.0.3405.86)
  npmPackages:
    @storybook/addon-svelte-csf: 5.0.7 => 5.0.7
    @storybook/addon-vitest: 9.1.2 => 9.1.2
    @storybook/sveltekit: 9.1.2 => 9.1.2
    storybook: 9.1.2 => 9.1.2

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions