storybook-rsbuild: Very long compilation time and error "Conflict: Multiple assets emit different content to the same filename iframe.html" when source.entry is set in rsbuild config

I try to migrate from storybook/vite to storybook with rsbuild but I have a compilation error :

yarn run v1.22.22
$ cross-env NODE_OPTIONS=--max-old-space-size=8192 storybook dev -p 6006
storybook v8.2.2

info => Serving static files from ./.\public at /
info => Starting manager..
info => Starting preview..
info Addon-docs: using MDX3
start   Compiling...
info Using tsconfig paths for react-docgen
error   Compile error: 
Failed to compile, check the errors for troubleshooting.
× Conflict: Multiple assets emit different content to the same filename iframe.html

The error seems non blocking : after closing the overlay, the storybook page run normally

I googled that error but it seems related to webpack, I didn’t find any hint

excerp of package.json :

"@rsbuild/core": "1.0.1-beta.1",
    "@rsbuild/plugin-eslint": "1.0.0",
    "@rsbuild/plugin-react": "1.0.1-beta.1",
    "@rsbuild/plugin-type-check": "1.0.1-beta.1",
    "@rsdoctor/rspack-plugin": "^0.3.7",
    "@storybook/addon-essentials": "8.2.2",
    "@storybook/addon-interactions": "8.2.2",
    "@storybook/addon-links": "8.2.2",
    "@storybook/addon-onboarding": "8.2.2",
    "@storybook/blocks": "8.2.2",
    "@storybook/react": "8.2.2",
    "@storybook/react-vite": "8.2.2",
    "@storybook/test": "8.2.2",
    "@storybook/test-runner": "0.19.0",
    "msw-storybook-addon": "2.0.3",
    "playwright": "1.45.1",
    "react-test-renderer": "18.3.1",
    "storybook": "8.2.2",
    "storybook-addon-manual-mocks": "1.0.4",
    "storybook-react-rsbuild": "0.0.7",
    "storybook-addon-remix-react-router": "3.0.0",
    "resolutions": {
       "@storybook/csf": "0.1.11"
    },

storybook config :

import { StorybookConfig } from 'storybook-react-rsbuild'
import { mergeRsbuildConfig } from '@rsbuild/core'

const config: StorybookConfig = {
  stories: [
    "../src/**/*.stories.@(ts|tsx)"
  ],
  addons: [
    "@storybook/addon-links",
    "@storybook/addon-essentials",
    "@storybook/addon-onboarding",
    "@storybook/addon-interactions",
    {
      name: "storybook-addon-manual-mocks/vite",
      options: {
        mocksFolder: "mocks",
      }
    },
    'storybook-addon-remix-react-router',
  ],
  framework: {
    name: 'storybook-react-rsbuild',
    options: {}
  },
  rsbuildFinal: (config) => {
    // see https://github.com/rspack-contrib/storybook-rsbuild#customize-the-rsbuild-config
    return mergeRsbuildConfig(config, {
      source: {
        include: [
          /node_modules[\\/]storybook-addon-remix-react-router[\\/]dist[\\/]index.js/
        ]
      }
    })
  },
  staticDirs: ['../public'],
  docs: {
    defaultName: "Docs",
    docsMode: false,
    autodocs: false,
  },
}

export default config

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 19 (11 by maintainers)

Most upvoted comments

@phildenhoff Nice catch, that’s the issue where it raised. As per https://rsbuild.dev/config/source/entry, Rsbuild will register html-rspack-plugin for each entry, no matter it’s explicit or implicit. So, when not explicitly adding an entry (using default entry then), no extra entry in config file will be loaded by Storybook builder, everything goes well. When adding one, multiple entries’ collision happens, and they’re trying to emit same output file. The workaround is to comply and use the default entry of Rsbuild, and remove the explicit added one. I’ll take a look into other builders’ implementation and see how they deal with the multiple entries. (filter out or de-confilict).

it works now with version 0.0.10 and web environment, thx a lot 👍

Storybook can read the web environment by default (if it is configured), and allow users to configure reading of another environment if required.

I’m not seeing the usage merging project’s rsbuild.config.entry into Storybook. Will stop source.entry from being merged.