storybookjs / storybook

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation
https://storybook.js.org
MIT License
84.15k stars 9.25k forks source link

[Bug]: manager bundles is outputed with double slashes #22465

Open tranvansang opened 1 year ago

tranvansang commented 1 year ago

Describe the bug

Background: I am a library author, not an enduser.

I want the static assets in the format of /assets/abc.png. By default, it is assets/abc.png.

To achieve this, I set config.output.publicPath = '/' in webpackFinal().

But this incurs another issue that the manager bundle has double slashes. I believe it is a bug in the manager build (with esbuild config).

iframe.html:355     GET http://localhost:6006//runtime.iframe.bundle.js net::ERR_ABORTED 404 (Not Found)
iframe.html:357     GET http://localhost:6006//vendors.iframe.bundle.js 404 (Not Found)
iframe.html:359     GET http://localhost:6006//main.iframe.bundle.js net::ERR_ABORTED 404 (Not Found)

Probably related link: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#no-more-configuration-for-manager

Expected behavior: the manager build should correctly handle slash in the publicPath configuration from webpackFinal's output. Or. Allow manually configure the publicPath.

To Reproduce

No response

System

"@storybook/addon-essentials": "^7.0.7",
        "@storybook/addon-interactions": "^7.0.7",
        "@storybook/addon-links": "^7.0.7",
        "@storybook/cli": "^7.0.7",
        "@storybook/core-client": "^7.0.7",
        "@storybook/core-server": "^7.0.7",
        "@storybook/manager-api": "^7.0.7",
        "@storybook/react": "^7.0.7",
        "@storybook/react-webpack5": "^7.0.7",
        "@storybook/theming": "^7.0.7",


### Additional context

_No response_
Pisyukaev commented 3 days ago

The same problem on v8.3.3


        "@storybook/addon-interactions": "^8.3.3",
        "@storybook/addon-links": "^8.3.3",
        "@storybook/addon-onboarding": "^8.3.3",
        "@storybook/addon-webpack5-compiler-swc": "^1.0.5",
        "@storybook/blocks": "^8.3.3",
        "@storybook/react": "^8.3.3",
        "@storybook/react-webpack5": "^8.3.3",
        "@storybook/test": "^8.3.3",```