---
title: Turborepo 1.4
date: 2022/08/09
description: Turborepo 1.4 has new examples, automatically includes environment variables, and more!
tag: web development
ogImage: /images/blog/turbo-1-4-0/twitter-card.png
---

# Turborepo 1.4

import { Authors } from "../../components/Authors";
import Callout from "../../components/Callout";
import Date from "../../components/blog/Date";

<Date>
  Tuesday, August 9th, 2022
</Date>

<Authors
  authors={[
    "gregsoltis",
    "nathanhammond",
    "tomknickman",
    "anthonyshew",
    "jaredpalmer",
    "mehulkar",
  ]}
/>

Turborepo 1.4 brings:

- [**Automatic environment variable inclusion:**](#automatic-environment-variable-inclusion) We'll automatically infer popular framework environment variables for you. No need to declare them yourself in `turbo.json`.
- [**`eslint-config-turbo`:**](#eslint-config-turbo) Enhanced feedback with a new ESLint plugin.
- [**New framework and library examples:**](#new-framework-and-library-examples) New starters and examples requested by the community.

Update today by running `npm install turbo@latest`.

## Automatic environment variable inclusion

To help ensure correct caching across environments Turborepo will now automatically infer and include public environment variables when calculating cache keys for apps built with Astro, Create React App, Gatsby, Next.js, Nuxt, SvelteKit, Vite, Vue, and more. You can safely remove framework-specific public environment variables from `turbo.json` if you manually declared them.

```diff filename="turbo.json"
{
  "pipeline": {
    "build": {
      "dependsOn": [
        "^build"
-       // Include build time public inlined environment variables that
-       // are different in development and production, so that
-       // Turborepo does not use the same cached build
-       // across environments
-       "$NEXT_PUBLIC_EXAMPLE_ENV_VAR"
      ]
    }
  }
}
```

Note that this automatic detection and inclusion only works if Turborepo successfully infers the framework your apps are built with. Additionally, the environment variables will only be included in the cache key for tasks in workspaces where that framework is used. In other words, environment variables inferred for Next.js apps, will only be included in the cache key for workspaces detected as Next.js apps. Tasks in other workspaces in the monorepo will not be impacted.

For example, consider a monorepo with three workspaces: a Next.js project, a Create React App project, and a TypeScript package. Each has a `build` script, and both apps depend on the TypeScript project. Let's say that this Turborepo has a standard `turbo.json` pipeline that builds them all in order:

```jsonc filename="turbo.json"
{
  "pipeline": {
    "build": {
      "dependsOn": ["^build"]
    }
  }
}
```

As of 1.4, when you run `turbo run build`, Turborepo will not consider any build time environment variables relevant when building the TypeScript package. However, when building the Next.js app, Turborepo will infer that environment variables starting with `NEXT_PUBLIC_` could alter the output of the `.next` folder and should thus be included when calculating the hash. Similarly, when calculating the hash of the Create React App's `build` script, all build time environment variables starting with `REACT_APP_PUBLIC_` will be included.

This improvement in hash specificity by framework is a significant step toward optimal, safe, and correct caching.

## `eslint-config-turbo`

We've also created a new ESLint config for further in-editor assistance to help ensure your Turborepo cache can be correctly shared across every environment. While our new hashing algorithm should cover most situations with most frameworks, this ESLint config will provide in-editor feedback for teams using other build time inlined environment variables that are not framework-prefixed but impact build outputs (i.e. caching), and teams using their own in-house frameworks that we cannot detect automatically.

To get started, extend from `eslint-config-turbo` in your root [`eslintrc`](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#configuration-file-formats) file:

```jsonc
{
  // Automatically flag env vars missing from turbo.json
  "extends": ["next/core-web-vitals", "turbo"]
}
```

If you prefer more control over the rules - use can install and configure the `eslint-plugin-turbo` _plugin_ directly by first adding it to plugins and then configuring the desired rules:

```jsonc
{
  "extends": ["next/core-web-vitals"],
  "plugins": ["turbo"],
  "rules": {
    // Automatically flag env vars missing from turbo.json
    "turbo/no-undeclared-env-vars": "error"
  }
}
```

The plugin will warn you if you are using non-framework-related environment variables in your code that have not been declared in your `turbo.json`.

As of 1.4.x, we now include `eslint-config-turbo` in all of our examples and in new projects generated via `npx create-turbo`.

Learn more about ESLint configs and plugins in the [ESLint docs](https://eslint.org/docs/latest/).

## New framework and library examples

Based on your feedback and suggestions, we've created new examples to integrate Turborepo into your workflow:

- [Svelte](https://github.com/vercel/turbo/tree/main/examples/with-svelte)
- [Docker](https://github.com/vercel/turbo/tree/main/examples/with-docker)
- [Create React App](https://github.com/vercel/turbo/tree/main/examples/with-create-react-app)
- [React Native](https://github.com/vercel/turbo/tree/main/examples/with-react-native-web)
- [Prisma](https://github.com/vercel/turbo/tree/main/examples/with-prisma)
- [Tailwind](https://github.com/vercel/turbo/tree/main/examples/with-tailwind)
- … [and more!](https://github.com/vercel/turbo/tree/main/examples)

## Other bug fixes and improvements

- Allow both sides of git comparison ([#1442](https://github.com/vercel/turbo/pull/1442))
- Properly rebuild packages that share a name prefix ([#1538](https://github.com/vercel/turbo/pull/1538))
- Cache files with the correct file permissions ([#1429](https://github.com/vercel/turbo/pull/1429))

## Community

Since releasing [Turborepo v1.3 in June](https://turbo.build/blog/turbo-1-3-0), we've seen incredible adoption and community growth:

- [8.65k+ GitHub Stars](https://github.com/vercel/turbo)
- 365k weekly NPM downloads, up 2x since late April
- 10 years of compute time saved through Remote Caching on Vercel, saving 10 months per week

Turborepo is the result of the combined work of all of our contributors including our core team.

This release was brought to you by the contributions of: @B2o5T, @chitchu, @elis, @gsoltis, @harshcut, @jaredpalmer, @kocisov, @nathanhammond, @neolivz, @NuroDev, @oneezy, @samouri, @shayc, @StevenMatchett, @tknickman, @trevorr, @zsoldosp, and more!

Thank you for your continued support, feedback, and collaboration to make Turborepo your build tool of choice.
