1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 07:08:01 +00:00

Add Pin Specific pnpm Version For Builds as a Vercel TIL

This commit is contained in:
jbranchaud
2022-10-20 21:12:40 -05:00
parent 02a56c7971
commit 9e13593d22
2 changed files with 37 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186). For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
_1257 TILs and counting..._ _1258 TILs and counting..._
--- ---
@@ -1286,6 +1286,7 @@ _1257 TILs and counting..._
- [Add Web Server Layer Redirects](vercel/add-web-server-layer-redirects.md) - [Add Web Server Layer Redirects](vercel/add-web-server-layer-redirects.md)
- [Deploy An App Without Pushing An Empty Commit](vercel/deploy-an-app-without-pushing-an-empty-commit.md) - [Deploy An App Without Pushing An Empty Commit](vercel/deploy-an-app-without-pushing-an-empty-commit.md)
- [Naming Of The Vercel Config File](vercel/naming-of-the-vercel-config-file.md) - [Naming Of The Vercel Config File](vercel/naming-of-the-vercel-config-file.md)
- [Pin Specific pnpm Version For Builds](vercel/pin-specific-pnpm-version-for-builds.md)
- [Share Development Environment Variables Via CLI](vercel/share-development-environment-variables-via-cli.md) - [Share Development Environment Variables Via CLI](vercel/share-development-environment-variables-via-cli.md)
### Vim ### Vim

View File

@@ -0,0 +1,35 @@
# Pin Specific pnpm Version For Builds
Vercel recognizes when [a project contain a `pnpm-lock.yaml`
file](https://vercel.com/changelog/projects-using-pnpm-can-now-be-deployed-with-zero-configuration)
and will automatically use [`pnpm`](https://pnpm.io/) for builds of that
project.
It looks for [the `lockfileVersion` in `pnpm-lock.yaml` to determine what major
version of `pnpm` to
install](https://vercel.com/docs/concepts/deployments/configure-a-build#install-command).
If the `lockfileVersion` is `5.4`, then it will use the latest pnpm v7.
Otherwise it will fallback to the latest pnpm v6.
That's the extent of the control you have over the `pnpm` version. That is,
unless you are to use [this experimental corepack
feature](https://vercel.com/docs/concepts/deployments/configure-a-build#corepack).
Set the `ENABLE_EXPERIMENTAL_COREPACK` environment variable to `1` in your
project's _Environment Variables_ under _Settings_.
Then specify the `pnpm` version with the `packageManager` key in your
`package.json`.
```json
{
"packageManager": "pnpm@7.13.2"
}
```
Even though the current latest is `7.13.5`, Vercel will see the Corepack
environment variables and the `packageManager` version and use `7.13.2`
instead.
See [this PR](https://github.com/skillrecordings/products/pull/535) and [this
issue](https://github.com/prisma/prisma/issues/12921#issuecomment-1284425847)
for more details.