【发布时间】:2020-02-04 18:37:24
【问题描述】:
刚刚启动了我在盖茨比的第一个项目。我按照此处的指南加载图像https://www.gatsbyjs.org/docs/importing-assets-into-files/
src/components/header.js
import logo from "../images/logo-color.png";
const Header = () => (
<Link to="/">
<img src={logo} alt="" />
</Link>
);
如文档To reduce the number of requests to the server, importing images that are less than 10,000 bytes returns a data URI instead of a path. 中所述,当我检查页面时,在我的图片的src 中,我看到了base64 代码,但页面上的图片已损坏?
对于如何转换这些图像有特定的规则吗?当我将徽标导入更改为新项目默认提供的图像之一时,这些图像会加载,但它们会加载实际的 src 路径并且未编码,因为我认为它们是较大的文件。
【问题讨论】: