a-w*_*ett 8 reactjs next.js storybook nextjs-image
我正在运行 Next.js 应用程序和 Storybook 组件库。我想在 Storybook 中使用 next/image ,以便我可以利用图像优化。
我按照这篇文章在 Storbook 中模拟了 next/image。该库使用 rollup 进行捆绑,仅导出由 Next.js 应用程序使用的 React 组件。但是,当在 Next 应用程序中安装时,会引发错误
Nothing was returned from render
我还尝试unoptimised仅在 Storybook 开发模式下将道具传递给 next/image ,因此当它安装在 node_modules 中时,将会有 next.js 应用程序和 next.js 服务器来处理图像,但会被抛出
hostname "...." is not configured under images in your `next.config.js
我已在包根目录中以及带有图像域数组的 next.js 应用程序根目录中包含了一个 next.config.js 文件。
总而言之:
如何在 NPM 组件库中使用 next/image,然后由 Next.js 应用程序使用
| 归档时间: |
|
| 查看次数: |
848 次 |
| 最近记录: |