Not sure if you're still having this issue, but I just ran into it setting up a new Styleguidist project with Create React App and Typescript....had the same issue, dev server worked fine, but something in the production build settings of create-react-app was causing conflicts with styleguidist's own internal things.
In styleguide.config.js, appended in my set up object
module.exports = {
// ...other configgy stuff,
webpackConfig: require('./node_modules/react-scripts/config/webpack.config.js')(
'development'
),
};
Not sure if this is 100% right but works for my situation.
Based on styleguidist's docs, some of the stuff set up for create-react-app may break the process
https://react-styleguidist.js.org/docs/webpack.html#reusing-your-projects-webpack-config
I guess you can also just do this..I just found it after hacking this fix
https://react-styleguidist.js.org/docs/cookbook#how-to-use-production-or-development-build-of-react
{
"scripts": {
"build": "cross-env NODE_ENV=development react-styleguidist build"
}
}
haven't tried that yet...guess I should have RTFM'ed first