v4.7 Release Notes
Welcome to gatsby@4.7.0
release (February 2022 #1)
Key highlights of this release:
trailingSlash
Option (Beta) - Now built into the Framework itself- Faster Schema Creation &
createPages
- Speed improvements of at least 30%
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.
trailingSlash
Option
Currently in Public Beta
Through the RFC Integrated handling of trailing slashes in Gatsby we’ve worked on making the trailing slashes feature a first-class citizen in Gatsby. We’re happy to announce that gatsby-config
now supports a trailingSlash
configuration with these three main options:
always
: Always add trailing slashes to each URL, e.g./x
to/x/
.never
: Remove all trailing slashes on each URL, e.g./x/
to/x
.ignore
: Don’t automatically modify the URL
You can set it like this:
Throughout Gatsby 4 the default setting for trailingSlash
will be legacy
(to keep the current behavior) but with Gatsby 5 we’ll remove the legacy
setting and make always
the default. Please note that these plugins are considered deprecated now: gatsby-plugin-force-trailing-slashes and gatsby-plugin-remove-trailing-slashes.
Gatsby Cloud supports this new setting out of the box and also uses 301
redirects to bring visitors to the right location. Locally you can use gatsby serve
to see the behavior. Any other hosting provider (or if you’re managing this on your own) should follow the “Redirects, and expected behavior from the hosting provider” section on the initial RFC.
If you’re unit testing gatsby-link
you’ll need to update the moduleNameMapper
option to include gatsby-page-utils
, see Unit Testing documentation for more details.
The information presented here is also available in the gatsby-config docs page and in the PR #34268 that implemented this.
Please share your feedback and any issues you encounter directly into the corresponding discussion.
Faster Schema Creation & createPages
We’ve seen a handful of sites struggling with long schema building
and createPages
steps. In this release, we’ve upgraded our external graphql-compose
dependency to v9 to improve these steps by at least 30-50% for schemas/queries with many relationships. For example, one of our customers has seen improvements for createPages
of 786s to 20s. This update is recommended to everyone and doesn’t necessitate any changes on your end.
More information can be found in the PR #34504.
Notable Bugfixes & Improvements
gatsby
:gatsby-plugin-fullstory
: Updated snippet, via PR #34583gatsby-core-utils
: Remote file downloads are now queued properly for all cases, via PR #34414gatsby-plugin-preact
: Fix alias forreact-dom/server
, via PR #34694- Added a
vanilla-extract
example project, via PR #34667
Contributors
A big Thank You to our community who contributed to this release 💜
- josephjosedev
- axe312ger
- seanparmelee
- millette: chore(gatsby-source-wordpress): Add WPGraphQL WPML PR #34609
- jeffreyvdhondel: feat(gatsby-plugin-google-gtag): add selfHostedOrigin option PR #34352
- Rutam21: fix(gatsby): fixes stacktraces from async functions break error reporting PR #33712
- rschristian: fix(gatsby-plugin-preact): Adding missing alias for
react/jsx-runtime
PR #34666 - tamaosa: fix(gatsby-plugin-preact): Fix alias for react-dom/server PR #34694- ollybenson: chore(docs): Update gatsby-plugin-image to mention local data source PR #34426
- rileyjshaw: chore(docs): update PurgeCSS instructions for Tailwind 3 PR #34726
- xaviemirmon: chore(docs): Update “Debugging HTML builds” to include
getServerData
PR #34631 - marceloverdijk: chore(docs): Added required
type
attribute to resolver PR #34716 - cameronbraid: chore(docs): Update
transformOptions
defaults PR #34713%