Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

v5.5 Release Notes

Welcome to gatsby@5.5.0 release (January 2023 #2)

Key highlights of this release:

Also check out notable bugfixes.

Bleeding Edge: Want to try new features as soon as possible? Install gatsby@next and let us know if you have any issues.

Previous release notes

Full changelog


Faster Hashing for gatsby-source-filesytem

GitHub user FraserThompson put up a feature request to optionally disable MD5 hashing inside gatsby-source-filesystem. Their site has around ~1000 MP3s (up to 120MB) and 16000 JPGs (around 2-3 MB), so gatsby-source-fileystem has to ingest a lot of data! While reading the data an MD5 hash is generated for each file to attach the contentDigest to the File node. Or in other words: This MD5 hash is used to determine if a file has changed and is used in Gatsby’s caching system.

We’d recommend reading the discussion inside the feature request as it shows a great case of collaboration and how productive open source work can look like. After exploring and debating about the best approach, the PR #37464 was put up. Here’s what has changed:

  • gatsby-source-filesystem now uses hash-wasm to calculate the MD5 hash for each file

  • Cache the inode and mtime file stats and only re-generate the MD5 hash if those changed

  • Introduce a new fastHash option to skip the MD5 hashing altogether. Instead, use the inode and mtime. On a modern OS this can be considered a robust solution to determine if a file has changed, however on older systems it can be unreliable. Therefore it’s not enabled by default.

FraserThompson also put these changes to the test with this test environment: 4774 files, 3363 images (1-3MB each), 284 MP3s (20-120MB each).

And here are the performance numbers 🚀

Configurationsource and transform nodes (cold)
gatsby-source-filesytem@5.4.0781 seconds
gatsby-source-filesytem@5.5.0494 seconds (36% decrease)
gatsby-source-filesytem@5.5.0 with fastHash10 seconds (98% decrease)

As you can see, already the enhancements achieved through hash-wasm are great! However, take these numbers with a grain of salt as your site will be different from the test environment. You’ll see bigger absolute improvements with a lot of big files.

Last but not least, it’s important to note that the upgrades were made to the createFileNode function. So if you’re using this utility in your site/plugin, you can also benefit from this.

Setting <html> and <body> attributes

You can now set the attributes of the <html> and <body> tags using the Head API. Gatsby will automatically incorporate these attributes into the page, with any attributes specified in the Head API taking precedence over those set through Gatsby Server Rendering APIs.

Notable bugfixes & improvements

  • gatsby:
    • pass serverData into Gatsby Head, via PR #37500
    • fix regression with file-loader imports when pathPrefix and/or assetPrefix is used, via PR #37423
    • fix pluginOptionsSchema not being called for local plugins with gatsby-node.ts, via PR #37443
    • support updated sort argument syntax in nodeModel.findAll function, via PR #37477
  • gatsby-source-contentful:
    • fix back reference fields disapearing after some content updates, via PR #37442

Contributors

A big Thank You to our community who contributed to this release 💜

Start building today on Netlify!
Edit this page on GitHub
© 2024 Gatsby, Inc.