【问题标题】:Styleguidist - Build with dev webpack configStyleguidist - 使用开发 webpack 配置构建
【发布时间】:2018-06-22 09:35:11
【问题描述】:

styleguidist server 完美运行(非常感谢)

我现在想构建静态 html 文件以粘贴在 github 页面中,但是..

styleguidist build throws TypeError: Cannot read property 'tapAsync' of undefined 这似乎源自 favicons-webpack-plugin,它仅在我的生产 webpack 配置中使用。

似乎 styleguidist build-p 标志传递给 webpack(或以其他方式导致使用此配置),但我更愿意只使用 dev 配置进行构建。

有人知道这是怎么可能的吗?

【问题讨论】:

  • 似乎是一个错误,最好报告一下。

标签: webpack react-styleguidist


【解决方案1】:

不确定您是否仍然遇到此问题,但我刚刚遇到了它,使用 Create React App 和 Typescript 设置了一个新的 Styleguidist 项目......有同样的问题,开发服务器工作正常,但在create-react-app 的生产构建设置导致与 styleguidist 自己的内部事物发生冲突。

在 styleguide.config.js 中,附加在我的设置对象中

module.exports = {
  // ...other configgy stuff,
    webpackConfig: require('./node_modules/react-scripts/config/webpack.config.js')(
    'development'
  ),
};

不确定这是否 100% 正确,但适用于我的情况。 根据 styleguidist 的文档,为 create-react-app 设置的一些东西可能会破坏流程

https://react-styleguidist.js.org/docs/webpack.html#reusing-your-projects-webpack-config

我想你也可以这样做..我只是在破解此修复程序后发现它 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"
  }
}

还没有尝试过……我想我应该先 RTFM

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-08-21
    • 2019-04-04
    • 2016-04-14
    • 1970-01-01
    • 2019-02-04
    • 2016-11-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多