Skip to content

Commit

Permalink
docs(platform): env BUILD_PRESET is optionally
Browse files Browse the repository at this point in the history
  • Loading branch information
cskiwi committed Jul 13, 2023
1 parent a8681c0 commit a8feff6
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions apps/docs-app/docs/features/deployment/providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,21 +143,22 @@ firebase deploy

## Vercel

Analog supports deploying on [Vercel](https://vercel.com/) with minimal configuration.
Analog supports deploying on [Vercel](https://vercel.com/) with no additional configuration.

### Create a new project
### Create the project

1. Create a new project and select the repository that contains your code.
You don't need to do anything special to deploy to Vercel, everything is handled automatically.

2. Add an environment variable with `BUILD_PRESET` set to `vercel`.
1. Create a new project and select the repository that contains your code.

3. Click 'Deploy'.
2. Click 'Deploy'.

### Nx and Vercel
### Vercel doesn't load the preset

When using Nx and reusing the build cache on the Vercel build platform, there is a possibility that the cache will be reused if you have built it locally. This can lead to the output being placed in the wrong location. To resolve this issue, you can set the Nitro preset to `vercel` so that the build output matches the one on Vercel.
There might be a case where Vercel doesn't load the preset automatically. In that case, you can do one of the following.

To achieve this, you need to update the `vite.config.ts` file. Add the following code snippet to the `plugins` section:
- Set the `BUILD_PRESET` environment variable to `vercel`.
- Set the preset in the `vite.config.ts` file:

```ts [vite.config.ts]
plugins: [
Expand All @@ -168,3 +169,7 @@ plugins: [
}),
];
```

#### Nx and vercel

When using Nx and reusing the build cache on the Vercel build platform, there is a possibility that the cache will be reused if you have built it locally. This can lead to the output being placed in the wrong location. To resolve this issue, you can use the preset in the `vite.config.ts` file as a workaround.

0 comments on commit a8feff6

Please sign in to comment.