Search code examples
javascripttypescriptgatsbystatic-site

Is there a way to use Gatsby just for static html files without webpacked javascript files?


I want to generate a large number of static html. I like to use Gatsby because I enjoy writing JSX/TSX and generating the files using JavaScript.

But then every page includes the dehydrated GraphQL queries as well as an entire react for production runtime.

I know that that's what Gatsby does, but it is so flexible I imagine there must be a way to just generate the static html without the magic parts.


Solution

  • There's no official support for this by Gatsby.

    Looking through their issues on github, there's one where this is discussed though (they have some fair reasons for not having support for it). At the end of the issue there's a comment linking to a gatsby plugin doing just what you want it seems. You might want to give it a try.

    Github issue: https://github.com/gatsbyjs/gatsby/issues/11680

    Gatsby plugin: https://www.npmjs.com/package/gatsby-plugin-no-javascript