Skip to content

[Bug]: can not set publicPath #34628

@yuyu668668

Description

@yuyu668668

Describe the bug

  • when I set the publicPath, it not work.

`import type { StorybookConfig } from '@storybook/angular';

const config: StorybookConfig = {
stories: ['../**/*.@(mdx|stories.@(js|jsx|ts|tsx))'],
addons: [],
framework: {
name: '@storybook/angular',
options: {},
},
core: {
builder: {
name: '@storybook/builder-webpack5',
options: {
fsCache: true,
},
},
},
webpackFinal: async (config, { configType }) => {
// Set publicPath to /fe/ for both development and production
if (config.output) {
config.output.publicPath = '/storybook/';
}

return config;

},
managerHead: (head) => `
${head}

`, previewHead: (head) => ` ${head} `, };

export default config;`

when open browser, it will error.
:4401/storybook/sb-manager/globals-runtime.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
:4401/storybook/sb-manager/runtime.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
:4401/storybook/favicon.svg:1 Failed to load resource: the server responded with a status of 404 (Not Found)

Reproduction link

https://storybook.js.org/docs/api/main-config/main-config-webpack-final

Reproduction steps

  1. set the publicPath
  2. run the storybook

System

System:
│  OS: Windows 11 10.0.26200
│  CPU: (12) x64 12th Gen Intel(R) Core(TM) i5-12450H
│  Binaries:
│  Node: 22.14.0 - D:\Program Files\nodejs\node.EXE
│  npm: 10.9.2 - D:\Program Files\nodejs\npm.CMD <----- active
│  Browsers:
│  Chrome: 147.0.7727.56
│  Edge: Chromium (140.0.3485.54)
│  Firefox: 143.0 - C:\Program Files\Mozilla Firefox\firefox.exe
│  npmPackages:
│  @storybook/angular: 10.3.5 => 10.3.5
│  storybook: 10.3.5 => 10.3.5

Additional context

No response

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