绝对路径在带图像的gatsby中不起作用?

时间:2018-07-05 14:26:14

标签: javascript reactjs gatsby

这是图片:

<img src="src/img/image.svg" alt="" />

文件夹结构如下:

src
 -img
 -components
 ...etc

但是图像什么也没显示,我在控制台中收到404错误?

1 个答案:

答案 0 :(得分:2)

Gatsby looks for static assets in the static folder at the root of your project,因此,如果您希望示例图像可以工作,并且不想使用Webpack模块系统,请确保图像位于static/src/img/image.svg