storybook: [Bug]: Terminal Warning on fresh install

Describe the bug

Running a fresh installation creates the following warning in the terminal. Is this expected? any way to rectify this?

15:39:38 [vite] (client) warning: Failed to resolve "\u0000/virtual:/@storybook/builder-vite/storybook-stories.js" from /virtual:/@storybook/builder-vite/vite-app.js. An id should be written. Did you pass a URL?
  Plugin: vite:import-analysis
  File: /virtual:/@storybook/builder-vite/vite-app.js:32:30
  30 |
  31 |      if (import.meta.hot) {
  32 |        import.meta.hot.accept('/virtual:/@storybook/builder-vite/storybook-stories.js', (newModule) => {
     |                               ^
  33 |        // importFn has changed so we need to patch the new one in
  34 |        window.__STORYBOOK_PREVIEW__.onStoriesChanged({ importFn: newModule.importFn });
^C%

Reproduction link

http://localhost:6006/

Reproduction steps

Install storybook with pnpm dlx storybook@latest init and select Vite + React. Run storybook and see the warning

System

Storybook Environment Info:

  System:
    OS: macOS 14.4.1
    CPU: (12) arm64 Apple M3 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    npm: 10.9.2 - ~/Library/Application Support/Herd/config/nvm/versions/node/v22.13.0/bin/npm
    pnpm: 10.2.0 - ~/Library/Caches/fnm_multishells/68997_1738805487661/bin/pnpm <----- active
  Browsers:
    Chrome: 132.0.6834.160
    Safari: 17.4.1
  npmPackages:
    @storybook/addon-essentials: ^8.5.3 => 8.5.3
    @storybook/addon-interactions: ^8.5.3 => 8.5.3
    @storybook/addon-mdx-gfm: ^8.5.3 => 8.5.3
    @storybook/addon-onboarding: ^8.5.3 => 8.5.3
    @storybook/blocks: ^8.5.3 => 8.5.3
    @storybook/experimental-nextjs-vite: ^8.5.3 => 8.5.3
    @storybook/react: ^8.5.3 => 8.5.3
    @storybook/react-vite: ^8.5.3 => 8.5.3
    @storybook/test: ^8.5.3 => 8.5.3
    eslint-plugin-storybook: ^0.11.2 => 0.11.2
    storybook: ^8.5.3 => 8.5.3

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 33
  • Comments: 23 (4 by maintainers)

Most upvoted comments

Fix is on its way.

** Disclaimer** This information might be inaccurate, due to it being generated automatically This is a known warning from Vite’s import analysis when handling virtual modules in development mode. It does not affect functionality and can be safely ignored. If you want to suppress this warning, you can add the following to your .storybook/main.js: js export default { framework: '@storybook/react-vite', stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], logLevel: 'error' // This will suppress warnings };

About Greptile

This response provides a starting point for your research, not a precise solution.

Help us improve! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

Edit Issue Bot Settings · Greptile

I got it to go away by setting logLevel in vite.config.ts

@jdavis-software Can we please move this conversation into a separate discussion thread please ? You’re bloating the comment thread with information unrelated to the reported issue. Thank you.

Awesome! When can we expect a new version to be out?

@pdfabbro looks like v8.5.4 already includes the fix (#30511)

I noted that the issue occurs when vite is bumped to version 6.1.0. Using version 6.0.9 the warning is no longer present.

Is there a proper solution to this warning ? I am on vite 6.0.9

I’ve had a bit of a dig through the CHANGELOG notes for Vite 6.1.0 and I think the warning was introduced as part of this PR: https://github.com/vitejs/vite/pull/18840. Looks like resolving HMR Deps by URL is a fallback now and will be removed in Vite v7.

If on vs code the “version lens” extension lets you see what’s going on in package .json. use it all the time

@Joerdwa good call, thanks for that! I didn’t even realize that’s how that worked.

@pdfabbro I would double check your package.json to ensure its not pulling a newer dependency based on semver .You might have "vite":"^6.0.9" which would install 6.1.0 as it’s in the semver range being a minor update.

I also get this in the terminal after upgrading to the .3 patch version. The above does not suppress it.