0

styleguidist server works perfectly (thanks very much)

I would now like to build the static html files for sticking in github pages but..

styleguidist build throws TypeError: Cannot read property 'tapAsync' of undefined which seems to originate from favicons-webpack-plugin which is only used in my production webpack config.

It seems that styleguidist build passes the -p flag to webpack (or otherwise causes this config to be used) but I would prefer to just build with the dev config.

Anyone know how or if this is possible?

Jon Wyatt
  • 1,786
  • 1
  • 11
  • 16

1 Answers1

0

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