Skip to content

[Bug]: the import path of vite-inject-mocker-entry.js should be relative #32428

@tmkx

Description

@tmkx

Describe the bug

Storybook artifacts are not necessarily hosted at the root path (for example, we host them on GitHub Pages), so the import path cannot be an absolute path.

Comparison with other assets:
Image

Reproduction link

none

Reproduction steps

  1. Use @storybook/react-vite
  2. storybook build

System

Storybook Environment Info:

  System:
    OS: macOS 26.0
    CPU: (10) arm64 Apple M1 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.18.0 - ~/.local/share/mise/installs/node/22.18.0/bin/node
    npm: 10.9.3 - ~/.local/share/mise/installs/node/22.18.0/bin/npm
    pnpm: 10.15.1 - ~/.local/share/mise/installs/node/22.18.0/bin/pnpm <----- active
  Browsers:
    Chrome: 140.0.7339.81
    Safari: 26.0
  npmPackages:
    @storybook/addon-docs: ^9.1.5 => 9.1.5 
    @storybook/react: ^9.1.5 => 9.1.5 
    @storybook/react-vite: ^9.1.5 => 9.1.5 
    storybook: ^9.1.5 => 9.1.5

Additional context

Source code:

const entryPath = '/vite-inject-mocker-entry.js';

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