绝对路径在 gatsby 中不适用于图像?
absolute path not working in gatsby with images?
图片如下:
<img src="src/img/image.svg" alt="" />
文件夹结构如下:
src
-img
-components
...etc
然而图像什么也没显示,我在控制台中收到 404 错误?
Gatsby looks for static assets in the static
folder at the root of your project,因此,如果您希望示例图像正常工作,并且不想使用 Webpack 模块系统,请确保您的图像位于 static/src/img/image.svg
。
图片如下:
<img src="src/img/image.svg" alt="" />
文件夹结构如下:
src
-img
-components
...etc
然而图像什么也没显示,我在控制台中收到 404 错误?
Gatsby looks for static assets in the static
folder at the root of your project,因此,如果您希望示例图像正常工作,并且不想使用 Webpack 模块系统,请确保您的图像位于 static/src/img/image.svg
。