News & Announcements
Yarn support on Netlify
Update, May 2021: We've made a ton of improvements to our Yarn support since this blog post was written. Please check out our docs for the most current information.
We're very excited to announce full support for Yarn, the dependency manager, on Netlify.
If that wasn't enough reason for us to like Yarn, the project uses Netlify to host their webpage and leverages our Deploy Previews feature.
Starting today, if you deploy a site that includes a
yarn.lock file in the base of the repository, we'll use Yarn to install dependencies. We'll do this automatically, without you having to change any configuration options. After the initial dependency linking, we'll store Yarn's cache for your project so future builds can use it to resolve package changes. If your dependencies don't change between deploys, you'll see those resolutions drop to under a second.
We've got a few environment variables you can set to control yarn behavior too:
YARN_VERSIONto select a version of yarn to use. Otherwise we default to 0.18.1 (Note for future readers: we periodically update our default yarn version to keep current so you should not have to specify a
YARN_VERSIONunless you are using very very recent features.)
YARN_FLAGSto set flags that we'll use when we automatically run
yarn installfor your build upon finding
You can set these either in the Build Environment Variables section of each site's settings, or via netlify.toml where you can if you choose use different settings for different branches.
We encourage everyone to give Yarn a try. Fast, secure and reproducible resolution will change the way you approach dependency management.