盖茨比的 StaticImage 不在 Storybook 中呈现
Gatsby's StaticImage not rendering in Storybook
我正在尝试使用 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
我想知道是否有一种方法可以在 Gatsby 之外使用 StaticImage
渲染组件?
组件很简单:
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.
我正在尝试使用 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
我想知道是否有一种方法可以在 Gatsby 之外使用 StaticImage
渲染组件?
组件很简单:
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.