Skip to content

[Bug]: Vite Pre-transform error: Failed to load url /sb-preview/runtime.js  #25256

@Hecatron

Description

@Hecatron

Describe the bug

When running storybook via vuejs, currently the following shows up in the console

12:55:22 [vite] Pre-transform error: Failed to load url /sb-preview/runtime.js (resolved id: /sb-preview/runtime.js). Does the file exist?

This is due to a new pre-transform feature of vite 5 I think
Currently storybook does already add the following in to the vite config as part of builder-vite

  build: {
    rollupOptions: {
      external: ['./sb-preview/runtime.js'],
    }
  }

What I think is also needed is the following

assetsInclude: ['/sb-preview/runtime.js'],

Fix pulled from the following

To Reproduce

pnpm create vue@latest
pnpm dlx storybook@latest init

System

Storybook Environment Info:

  System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
  Binaries:
    Node: 20.8.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.2.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.12.1 - ~\AppData\Local\pnpm\pnpm.CMD <----- active
  Browsers:
    Edge: Spartan (44.19041.3570.0), Chromium (120.0.2210.77)

Metadata

Metadata

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions