Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storybook build success but error when serving

Tags:

storybook

I have encountered a problem when serving a built storybook. As you can see below, it shows only a spinner spinning into oblivion. When i opened the console, it says: Error: manager received sharedStateChanged-manager-storybook/viewport but was unable to determine the source of the event

empty spinner

Here's my storybook configuration files:

main.js

module.exports = {
  stories: [
    "../src/**/*.stories.mdx",
    "../src/**/*.stories.@(js|jsx|ts|tsx)"
  ],
  addons: [
    "@storybook/addon-links",
    "@storybook/addon-essentials",
    "@storybook/preset-create-react-app"
  ],
  webpackFinal: config => {
    return {
      ...config,
      plugins: config.plugins.filter(plugin => {
        if (plugin.constructor.name === 'ESLintWebpackPlugin') {
          return false
        }
        return true
      }),
    }
  }
}

preview.js

import '../src/recore/.storybook/preview.css'
import * as Recore from '../src/recore'

Recore.init({
  defaults: {
    IMAGE_RESOLVER: path => {
      return import('../src/assets/' + path)
    }
  }
})

export const parameters = {
  actions: { argTypesRegex: "^on[A-Z].*" },
}

To build the storybook, i run build-storybook -o ./build -s ./public -c .storybook I am using npm, and it told me to do npm run build-storybook -- -o ... but it doesn't behave as expected. Also, I currently use "@storybook/react": "^6.1.21"

Has anyone encountered this problem before? Can you help me to fix it? Many thanks before!

like image 238
Andree Christian Avatar asked Jul 15 '26 01:07

Andree Christian


1 Answers

When I had this problem I was starting the static file serving with npx serve -s.

Changing the startup to npx serve fixed the problem (this was hosting on a Linux web app in Azure).

like image 143
Bazza Avatar answered Jul 16 '26 14:07

Bazza



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!