Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gatsby build html content is empty

I have a website done in [email protected]. When I run gatsby build and inspect the generated html, for every page, all I see is an empty div: <div id="___gatsby"></div. The html contains the stylesheets, javascript files and everything needed to run the app (which works by the way).

Even if I curl the production url, the same div appears and is completely empty. I also tried with javascript disabled and all I get is a blank page. My config contains nothing fancy:

module.exports = {
    siteMetadata: {
        title      : `MyApp`,
        description: ``,
        author     : ``,
    },
    plugins     : [
        `gatsby-plugin-react-helmet`,
        {
            resolve: `gatsby-source-filesystem`,
            options: {
                name: `images`,
                path: `${__dirname}/src/static/images`,
            },
        },
        {
            resolve: `gatsby-plugin-less`,
            options: {
                javascriptEnabled: true,
            },
        },
        `gatsby-transformer-sharp`,
        `gatsby-plugin-sass`,
        `gatsby-plugin-sharp`,
        `gatsby-plugin-typescript`,
        `gatsby-plugin-styled-components`,
        {
            resolve: `gatsby-plugin-google-fonts`,
            options: {
                fonts: [
                    `Montserrat\:200,400,600,800`,
                ],
            },
        },
        {
            resolve: `gatsby-plugin-manifest`,
            options: {
                name            : `MyApp.com`,
                short_name      : `MyApp`,
                start_url       : `/`,
                background_color: `#4DECDB`,
                theme_color     : `#2F57E4`,
                display         : `minimal-ui`,
                icon            : `src/static/images/logo.png`,
            },
        },
        `gatsby-plugin-offline`,
        {
            resolve: `gatsby-plugin-google-analytics`,
            options: {
                // replace "UA-XXXXXXXXX-X" with your own Tracking ID
                trackingId: 'UA-111111111-16',
            },
        },
        //  last
        'gatsby-plugin-netlify',
    ],
}

My gatbsy-node file is empty and gatsby-browser just loads a stylesheet and a redux store:

import wrapWithProvider from './wrap-wit-provider'

import './src/components/layout/styles.less'

export const wrapRootElement = wrapWithProvider

Any ideas what I should look for? I wouldn't be that concerned unless Netlify's inability to detect my forms and process them due to non-existing html code.

like image 358
Romeo Mihalcea Avatar asked Mar 25 '19 21:03

Romeo Mihalcea


1 Answers

I got here searching for "blank page" on gatsby build, the problem in my case was a silly one, hope it helps someone.

If public folder has been modified, or file moved, gatsby will fail. Just deleting entire folder and rebuilding worked fine.

like image 139
BrunoS Avatar answered Nov 15 '22 02:11

BrunoS