Skip to content

chromaui/addon-visual-tests was loaded twice with vite@8 #415

@timofei-iatsenko

Description

@timofei-iatsenko

Describe the bug

Hello, i'm trying to upgrade my project to the Vite 8 with Rolldown, and after upgrading Storybook does not work.

The console message said:

chromaui/addon-visual-tests was loaded twice, this could have bad side-effects

And generated project-annotations.js has 2 identical imports

Image

And error caused by that:

Uncaught SyntaxError: Identifier 'preview_24597' has already been declared (at project-annotations.js:8:1)

Disabling '@chromatic-com/storybook', in storybook config resolves the issue.

To reproduce

// .storybook/main.ts

import type { StorybookConfig } from '@storybook/react-vite'
import react from '@vitejs/plugin-react'

const config: StorybookConfig = {
  stories: [
    '../packages/**/*.mdx',
    '../packages/**/*.stories.@(js|jsx|mjs|ts|tsx)',
  ],
  addons: [
    '@storybook/addon-links',
    '@chromatic-com/storybook',
    '@storybook/addon-a11y',
    '@storybook/addon-docs',
  ],
  core: {
    disableTelemetry: true,
    disableWhatsNewNotifications: true,
  },
  viteFinal: (config) => {
    config!.resolve = {
      ...config!.resolve,
      tsconfigPaths: true,
    }
    config!.plugins!.push(react())
    return config
  },
  framework: {
    name: '@storybook/react-vite',
    options: {},
  },
}
export default config

Just run Storybook in dev mode and see the console errors.

Environment

"storybook": "^10.3.3",
"@storybook/addon-a11y": "^10.3.3",
"@storybook/addon-docs": "^10.3.3",
"@storybook/addon-links": "^10.3.3",
"@storybook/addon-onboarding": "^10.3.3",
"@storybook/react-vite": "^10.3.3",
"@chromatic-com/storybook": "^5.1.0",
"vite": "^8.0.2", 
"@vitejs/plugin-react": "^6.0.1",

Package Manager: pnpm@9.15.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions