【问题标题】:Adding next.js into a component library to make use of Next.js features将 next.js 添加到组件库中以使用 Next.js 功能
【发布时间】:2021-01-17 13:49:18
【问题描述】:

我正在制作一个将在 Next.js 项目中使用的 React 组件库。我想将 Next.js 的功能添加到我的组件中。

只需在组件库中添加 Next.js 作为开发依赖项就足够了吗?

【问题讨论】:

    标签: reactjs next.js storybook


    【解决方案1】:

    如果您打算将组件作为包发布,则需要将 next.js 添加到 peerDependencies。这样做表明您的项目依赖于 next.js 中的内容,但它不包含在您的包中,应该安装在实际项目本身上。

    详情请看这里:https://classic.yarnpkg.com/en/docs/dependency-types/#toc-peerdependencies

    【讨论】:

      猜你喜欢
      • 2020-09-10
      • 1970-01-01
      • 2018-12-06
      • 2022-01-02
      • 2022-01-25
      • 2021-05-25
      • 2017-11-28
      • 1970-01-01
      • 2020-12-01
      相关资源
      最近更新 更多