Our great sponsors
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
inside the repository with which I deployed this post which you are reading right now:
Yarn tells us that it found package @maiertech/gatsby-theme-posts-core at version 0.8.0, which is a dependency of @maiertech/gatsby-theme-digitial-garden. It also tells us that it hoisted this version, which makes sense because @maiertech /gatsby-theme-posts-core is used only once in the entire project.
This post discusses the concept of hoisting, which is a staple of Yarn 1. Yarn 2's Plug'n'Play has addressed most issues around hoisting, making this post partially obsolete as soon as you move to Yarn 2. In this post Yarn (without version number) refers to Yarn 1.
Yarn tells us that browserslist is a direct dependency of package gatsby and it appears a few more times in the dependecy tree. All specified versions of browserslist are compatible with version 4.16.3, which was the latest version when I created this output. Therefore, Yarn hoisted version 4.16.3. The entry for browserslist in yarn.lock reveals which version declarations it actually found, all of them compatible with 4.16.3:
The docs do not describe Yarn's hoisting algorithm, but mention certain hoisting guarantees. The conclusion is that you should not expect your node_modules folder to have a specific layout. As you will see later in this post, small changes in dependencies can cause big changes in the layout of node_modules. Another thing to keep in mind is that hoisting packages only works when package versions are compatible in a semantic versioning sense, i.e. they need to have the same major version number (but not 0).
Related posts
- The gatsby build command will not complete or terminate
- Converting a Gatsby Site to Use TypeScript
- RFC: Adapters - Making it easier to build & deploy Gatsby on any platform
- uBO’s removal of <noscript> elements causes issue on Gatsby website
- Can anyone help me with the WordPress Gatsby setup?