[pull] main from tldraw:main#535
Merged
Merged
Conversation
### Problem
Docs and marketing are two separate Next apps on Vercel. When marketing
rewrites a path (e.g. `tldraw.dev/quick-start`) and returns docs HTML,
the browser’s address bar is still the marketing origin, but the HTML
referenced `/_next/static/...` as root-relative paths. Those requests
went to marketing’s `/_next` (wrong app / wrong hashes) instead of docs’
`/_next`.
Setting `ASSET_PREFIX` only in some environments (or only on Production)
was easy to get wrong: Preview builds often had no prefix, and
Production could pin the wrong hostname (e.g. a `*.vercel.app` alias)
while the live site was `tldraw.dev`, which caused 404s, cache skew (old
HTML vs new static files), and confusion.
### What we changed
`assetPrefix` (and the same base for `assetUrl()` on `public/` paths)
now resolves to:
1. `ASSET_PREFIX` when set (explicit override), else
2. `https://${VERCEL_URL}` on Vercel (the current deployment URL), else
3. unset locally → root-relative assets as before.
### Why it helps
- Every Vercel build automatically points JS/CSS (and prefixed `public/`
URLs) at that deployment’s static host, without maintaining
Preview-specific `ASSET_PREFIX` for every branch.
- `ASSET_PREFIX` remains an escape hatch when you need a fixed canonical
origin (e.g. force the apex in prod).
- Docs HTML served through rewrites still loads `/_next` from the docs
deployment that produced the page, which removes the “wrong `/_next`
host” class of bugs.
### Change type
- [ ] `bugfix`
- [x] `improvement`
- [ ] `feature`
- [ ] `api`
- [ ] `other`
In order to fix dotcom deploys, this PR bumps the pinned `vercel` CLI from `^34.4.0` to `^52.0.0`. The Vercel deploy endpoint now rejects clients older than `47.2.2` with the error below, so deploys fail at the upload step. Latest stable is `53.1.1` but our `npmMinimalAgeGate: 7d` setting in `.yarnrc.yml` blocks anything younger than 7 days, so `52.0.0` is the highest currently installable. Verified all CLI surfaces used in `internal/scripts/deploy-dotcom.ts` still exist in v52: `vercel link --project`, `vercel deploy --prebuilt [--prod]`, `vercel alias set`, global `--token` / `--scope` / `--yes` flags, `VERCEL_ORG_ID` / `VERCEL_PROJECT_ID` env vars, and the `Inspect:` / `Preview:` / `Production:` stdout lines that `deploySpa()` regex-parses. ### Deploy error ``` Error: Your Vercel CLI version is outdated. This endpoint requires version 47.2.2 or later. Please upgrade by running npm i -g vercel@latest. ``` ### Change type - [x] `other` ### Test plan - [ ] Unit tests - [ ] End to end tests ### Code changes | Section | LOC change | | -------------- | --------------- | | Config/tooling | +1456 / -723 | (All churn is `yarn.lock` updates from the vercel dep bump; `package.json` is +1/-1.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )