Error during production build when using Preact plugin
See original GitHub issueWhen I add the Preact plugin development works fine, but when I run gatsby build
I get this:
error Building static HTML for pages failed
See our docs page on debugging HTML builds for help https://goo.gl/yL9lND
60 | }
61 |
> 62 | if (location.pathname === rootPath) {
| ^
63 | header = (
64 | <h1>
65 | <Linker to={'/'}>Gatsby Starter Blog</Linker>
WebpackError: Cannot read property 'pathname' of undefined
- index.js:62 Template.render
src/layouts/index.js:62:18
- preact-compat.js:496 callMethod
~/preact-compat/dist/preact-compat.js:496:1
- preact-compat.js:507 Template.render
~/preact-compat/dist/preact-compat.js:507:1
- index.js:155 renderToString
~/preact-render-to-string/dist/index.js:155:1
- index.js:162 renderToString
~/preact-render-to-string/dist/index.js:162:1
- index.js:162 renderToString
~/preact-render-to-string/dist/index.js:162:1
- index.js:162 renderToString
~/preact-render-to-string/dist/index.js:162:1
- index.js:162 renderToString
~/preact-render-to-string/dist/index.js:162:1
- index.js:162 renderToString
~/preact-render-to-string/dist/index.js:162:1
- gatsby-ssr.js:25 Object.exports.replaceRenderer
~/gatsby-plugin-styletron/gatsby-ssr.js:25:1
When I remove the plugin the production build is successful.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Error Boundaries
Error boundaries catch errors during rendering, in lifecycle methods, and in ... If you don't use Create React App, you can add this...
Read more >preact build does not work when Webpack 5 is installed
In that project, trying to run preact build <args> from an npm build script failed. Following that, I created a minimal Preact application...
Read more >Gatsby Changelog | 5.3.0
When you saw the error "Building static HTML failed for path . ... For example, in gatsby-plugin-image you were able to use it...
Read more >Error handling for production application in Preact
Preact is a great alternative to React. It is made for creating modern Web Application and weights a... Tagged with preact, tutorial, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@codejet Preact support for Gatsby 2 is broken currently.
Since you have upgraded to Gatsby v2, we’ll be closing this in favor of #8545
After upgrading to Gatsby 2 there is a different issue which is described here https://github.com/gatsbyjs/gatsby/issues/8545