Skip to content

Commit

Permalink
remove ENABLE_VC_BUILD checks, use v3 build output API for all vercel…
Browse files Browse the repository at this point in the history
… apps (#5514)
  • Loading branch information
Rich-Harris authored Jul 13, 2022
1 parent 0dd1794 commit d090a59
Show file tree
Hide file tree
Showing 4 changed files with 159 additions and 290 deletions.
6 changes: 6 additions & 0 deletions .changeset/warm-knives-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@sveltejs/adapter-static': patch
'@sveltejs/adapter-vercel': patch
---

Remove ENABLE_VC_BUILD check, use v3 build output API for all apps deployed to Vercel
24 changes: 1 addition & 23 deletions packages/adapter-static/platforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,8 @@ function vercel_routes(builder) {
/** @type {Platform[]} */
export const platforms = [
{
// Build Output API
// TODO remove the ENABLE_VC_BUILD check when no longer required
name: 'Vercel',
test: () => !!process.env.VERCEL && !!process.env.ENABLE_VC_BUILD,
test: () => !!process.env.VERCEL,
defaults: (config) => ({
pages: `.vercel/output/static/${config.kit.appDir}/prerendered`,
assets: '.vercel/output/static'
Expand All @@ -80,25 +78,5 @@ export const platforms = [
})
);
}
},
{
// Legacy filesystem API
// TODO remove once Build Output API leaves beta
name: 'Vercel',
test: () => !!process.env.VERCEL,
defaults: (config) => ({
pages: `.vercel_build_output/static/${config.kit.appDir}/prerendered`,
assets: '.vercel_build_output/static'
}),
done: (builder) => {
if (!fs.existsSync('.vercel_build_output/config')) {
fs.mkdirSync('.vercel_build_output/config');
}

fs.writeFileSync(
'.vercel_build_output/config/routes.json',
JSON.stringify(vercel_routes(builder))
);
}
}
];
2 changes: 0 additions & 2 deletions packages/adapter-vercel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ If you're using [adapter-auto](../adapter-auto), you don't need to install this

## Usage

> The `edge` and `split` options depend on the Vercel Build Output API which is currently in beta. For now, you must opt in by visiting `https://vercel.com/[YOUR_USERNAME]/[YOUR_PROJECT]/settings/environment-variables` and adding `ENABLE_VC_BUILD` with the value `1`.
Add `"@sveltejs/adapter-vercel": "next"` to the `devDependencies` in your `package.json` and run `npm install`.

Then in your `svelte.config.js`:
Expand Down
Loading

0 comments on commit d090a59

Please sign in to comment.