时收到错误消息
Can't resolve '../../images/hero.svg'
-
我正在尝试从
images folder
导入svg图像
-
并将其设置在
header.scss
中作为背景图像:background-image: url('../../images/hero.svg');
我的盖茨比结构:
├─ src
├── scss
│ ├── main.scss
│ ├── modules
│ └──── header.scss
└── images
└── hero.svg
gatsby-config.js:
module.exports = {
siteMetadata: {
title: 'Test',description: 'test',author: '@gatsbyjs'
},plugins: [
'gatsby-plugin-react-helmet',{
resolve: 'gatsby-source-filesystem',options: {
name: 'images',path: `${__dirname}/src/images`
}
},'gatsby-transformer-sharp','gatsby-plugin-sharp',{
resolve: 'gatsby-plugin-manifest',options: {
name: 'Test',short_name: 'test',start_url: '/',background_color: '#663399',theme_color: '#663399',display: 'minimal-ui',icon: 'src/images/android-chrome-192x192.png'
}
},'gatsby-plugin-sass',{
resolve: 'gatsby-plugin-react-svg',options: {
rule: {
include: /\.inline\.svg$/
}
}
}
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more,visit: https://gatsby.dev/offline
// `gatsby-plugin-offline`,]
}
谢谢。