Привет, я получаю сообщение об ошибке, пробовал и искал много решений, но безуспешно.
Вот ошибка:
failed Building static HTML for pages - 6.632s
ERROR #95313
Building static HTML failed for path "/blog/path/"
See our docs page for more info on this error: https://gatsby.dev/debug-html
WebpackError: TypeError: Cannot read properties of undefined (reading 'fallback')
- gatsby-image.server.tsx:62
webpack:/gatsby-poc/src/components/gatsby-image.server.tsx:62:16
- index.js:59
[gatsby-poc]/[decode-uri-component]/index.js:59:1
- index.js:61
[gatsby-poc]/[decode-uri-component]/index.js:61:1
- index.js:67
[gatsby-poc]/[decode-uri-component]/index.js:67:1
- index.js:4
gatsby-poc/src/pages/index.js:4:1
- index.js:69
[gatsby-poc]/[decode-uri-component]/index.js:69:1
- index.js:67
[gatsby-poc]/[decode-uri-component]/index.js:67:1
- index.js:4
gatsby-poc/src/pages/index.js:4:1
- Footer.js:7
gatsby-poc/src/components/Footer.js:7:132
- index.js:67
[gatsby-poc]/[decode-uri-component]/index.js:67:1
- index.js:4
gatsby-poc/src/pages/index.js:4:1
- Footer.js:7
gatsby-poc/src/components/Footer.js:7:132
- index.js:67
[gatsby-poc]/[decode-uri-component]/index.js:67:1
- index.js:4
gatsby-poc/src/pages/index.js:4:1
- Footer.js:7
gatsby-poc/src/components/Footer.js:7:132
- index.js:67
[gatsby-poc]/[decode-uri-component]/index.js:67:1
Установлены зависимости:
"dependencies": {
"babel-plugin-styled-components": "^2.0.7",
"gatsby": "^5.1.0",
"gatsby-plugin-gatsby-cloud": "^5.1.0",
"gatsby-plugin-image": "^3.1.0",
"gatsby-plugin-manifest": "^5.1.0",
"gatsby-plugin-offline": "^6.1.0",
"gatsby-plugin-react-helmet": "^6.1.0",
"gatsby-plugin-sharp": "^5.1.0",
"gatsby-plugin-styled-components": "^6.0.0",
"gatsby-source-filesystem": "^5.1.0",
"gatsby-source-wordpress": "^7.1.0",
"gatsby-transformer-sharp": "^5.1.0",
"html-react-parser": "^3.0.4",
"lodash": "^4.17.20",
"postcss": "^8.2.10",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-helmet": "^6.1.0",
"styled-components": "^5.3.6",
"typeface-merriweather": "1.1.13",
"typeface-montserrat": "1.1.13"
},
Я использую GatsbyImage как:
<GatsbyImage
image = {featuredImage.data}
alt = {featuredImage.alt}
style = {{ marginBottom: 50 }}
/>
Graphql для того же:
featuredImage {
node {
altText
localFile {
childImageSharp {
gatsbyImageData(
quality: 100
placeholder: TRACED_SVG
layout: FULL_WIDTH
)
}
}
}
}
}
ПРИМЕЧАНИЕ: он работает в разработке, но не работает в сборке.
выводы: если я удалю тег GatsbyImage, он начнет работать. Кажется, что-то не так с использованием этого тега.
<GatsbyImage
image = {featuredImage.data}
alt = {featuredImage.alt}
style = {{ marginBottom: 50 }}
/>
Это исправлено, проблема была с заполнителем SVG.
Измененный:
featuredImage {
node {
altText
localFile {
childImageSharp {
gatsbyImageData(
quality: 100
placeholder: TRACED_SVG
layout: FULL_WIDTH
)
}
}
}
}
}
К:
node {
altText
localFile {
childImageSharp {
gatsbyImageData(
quality: 100
placeholder: DOMINANT_COLOR
layout: FULL_WIDTH
)
}
}
}
}
}