gpt4 book ai didi

javascript - Gatsby 的 StaticImage 未在 Storybook 中呈现

转载 作者:行者123 更新时间:2023-12-05 00:29:28 32 4
gpt4 key购买 nike

我正在尝试使用 Gatsby 的 StaticImage 为我的组件编写故事书但这最终什么都没有呈现,并且在控制台中伪装成警告的错误:

Please ensure that "gatsby-plugin-image" is included in the plugins array in gatsby-config.js, and that your version of gatsby is at least 2.24.78
(anonymous) @ static-image.server.tsx:52
我想知道是否有办法使用 StaticImage 渲染组件在 Gatsby 之外?
组件很简单:
import React from 'react';
import { StaticImage } from 'gatsby-plugin-image';

export const Card = ({ title }) => {
return (
<div>
<div>{title}</div>
<StaticImage src="../../assets/images/background.png" alt="" width={300} height={100}/>
</div>
);
};
我正在使用 Gatsby v3 和 Storybook v6.3

最佳答案

基于Gatsby Documentation , 目前还不支持。

Note: Writing stories for components that use StaticImage from gatsby-plugin-image is currently not supported. Contributions to making this possible are welcome.

关于javascript - Gatsby 的 StaticImage 未在 Storybook 中呈现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68231092/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com