v4.8 Release Notes
firstname.lastname@example.org release (February 2022 #2)
Key highlights of this release:
- Support for TypeScript in
- New TypeScript option when creating Gatsby projects from the CLI
- Significant memory usage reduction when filtering and sorting nodes
- New APIs in
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.
Support for TypeScript in
In addition to Gatsby’s current TypeScript support for your site’s
.tsx files, you can now use TypeScript with your
GatsbySSR types can now be used in
Work is in progress for TypeScript support for
gatsby-node files. Check out the RFC to learn how to test it out today.
New TypeScript option when creating Gatsby projects from the CLI
When initializing new Gatsby projects with
npm init gatsby, or
gatsby-starter-minimal, and selecting TypeScript will start your project with
-ts flag has been added for use with
npm init gatsby and
npx create-gatsby. Executing
npm init gatsby -ts or
npx create-gatsby -ts will skip the language question and start your project with
Lastly, arguments for Gatsby initializer commands are now not positional. Any order of your desired site name and flags will work as expected (e.g.
npm init gatsby -ts hello-world -y).
Significant memory usage reduction when filtering and sorting nodes
Gatsby no longer stores whole nodes in memory when executing filtering and sorting processes on your site. Now, Gatsby uses weak references and node partials, resulting in significant memory usage reduction for sites with many large nodes.
See PR #34747 for more information.
New APIs in
Two new APIs have been added:
createMutex gives you a mutex that you can use to safely perform processes concurrently in places where that matters, such as in workers.
For example in the code below, one worker can execute while all others wait for it to finish. This is handy in scenarios like writing to the same file to disk.
hasFeature allows you to check if the current version of Gatsby has a certain feature. This is particularly useful for plugin authors.
Note - The list of features available will be added in future PRs, the above is an example of how it will be used.
Notable bugfixes & improvements
gatsby-plugin-gatsby-cloud: Improved UX for preview success and error notifications, via PR #34725
- Removal of
v8-compile-cachefor better ESM support, via PR #34672
- Support use of
node.slugto match node manifests to pages for Gatsby Preview, via PR #34790
- Fix Content Sync when using DSG, via PR #34799
- Allow referencing derived types in schema customization, via PR #34787
- Refactor load plugin modules, via PR #34813
- Upgrade from lmdb-store to lmdb, via PR #34576
- Removal of
gatsby-source-wordpress: Fix Safari image loading bug, via PR #34727
gatsby-core-utils: Improvements to
fetch-remote-file, via PR #34758
A big Thank You to our community who contributed to this release 💜
- kyleslie2: Typo fix PR #34749
- angeloashmore: chore(docs): Add Prismic to
- paulduszak: chore(docs): Update “building a theme” tutorial PR #34732
- jhcao23: docs: update typo Forestry PR #34805
- VividhPandey003: documentation: Add Third Party Schema PR #34820