From 1f86a348441d7adc616f9a1d0873538596fd4010 Mon Sep 17 00:00:00 2001 From: JuanM04 Date: Fri, 22 Jul 2022 10:16:11 -0300 Subject: [PATCH 1/2] Remove requirement of `ENABLE_VC_BUILD=1` --- packages/integrations/vercel/README.md | 17 +---------------- .../integrations/vercel/src/edge/adapter.ts | 6 ------ .../vercel/src/serverless/adapter.ts | 6 ------ .../integrations/vercel/src/static/adapter.ts | 6 ------ 4 files changed, 1 insertion(+), 34 deletions(-) diff --git a/packages/integrations/vercel/README.md b/packages/integrations/vercel/README.md index b6b6d988d97d..aaab5eb40520 100644 --- a/packages/integrations/vercel/README.md +++ b/packages/integrations/vercel/README.md @@ -63,25 +63,10 @@ import vercel from '@astrojs/vercel/static'; You can deploy by CLI (`vercel deploy`) or by connecting your new repo in the [Vercel Dashboard](https://vercel.com/). Alternatively, you can create a production build locally: ```sh -ENABLE_VC_BUILD=1 astro build +astro build vercel deploy --prebuilt ``` -**Vercel's [Build Output API](https://vercel.com/docs/build-output-api/v3) must be enabled.** You must enable it yourself by setting the environment variable: `ENABLE_VC_BUILD=1`. - -```js -// vercel.json -{ - "build": { - "env": { - "ENABLE_VC_BUILD": "1" - } - } -} -``` - -[Learn more about setting enviroment variables in Vercel](https://vercel.com/docs/concepts/projects/environment-variables). - ## Configuration This adapter does not expose any configuration options. diff --git a/packages/integrations/vercel/src/edge/adapter.ts b/packages/integrations/vercel/src/edge/adapter.ts index 6cd3405f6fa3..84ecd7395265 100644 --- a/packages/integrations/vercel/src/edge/adapter.ts +++ b/packages/integrations/vercel/src/edge/adapter.ts @@ -40,12 +40,6 @@ export default function vercelEdge(): AstroIntegration { } }, 'astro:build:start': async ({ buildConfig }) => { - if (String(process.env.ENABLE_VC_BUILD) !== '1') { - throw new Error( - `The enviroment variable "ENABLE_VC_BUILD" was not found. Make sure you have it set to "1" in your Vercel project.\nLearn how to set enviroment variables here: https://vercel.com/docs/concepts/projects/environment-variables` - ); - } - buildConfig.serverEntry = serverEntry = 'entry.mjs'; buildConfig.client = new URL('./static/', _config.outDir); buildConfig.server = functionFolder = new URL('./functions/render.func/', _config.outDir); diff --git a/packages/integrations/vercel/src/serverless/adapter.ts b/packages/integrations/vercel/src/serverless/adapter.ts index 9633cdeca1be..a83dcab746fc 100644 --- a/packages/integrations/vercel/src/serverless/adapter.ts +++ b/packages/integrations/vercel/src/serverless/adapter.ts @@ -30,12 +30,6 @@ export default function vercelEdge(): AstroIntegration { _config = config; }, 'astro:build:start': async ({ buildConfig }) => { - if (String(process.env.ENABLE_VC_BUILD) !== '1') { - throw new Error( - `The enviroment variable "ENABLE_VC_BUILD" was not found. Make sure you have it set to "1" in your Vercel project.\nLearn how to set enviroment variables here: https://vercel.com/docs/concepts/projects/environment-variables` - ); - } - buildConfig.serverEntry = serverEntry = 'entry.js'; buildConfig.client = new URL('./static/', _config.outDir); buildConfig.server = functionFolder = new URL('./functions/render.func/', _config.outDir); diff --git a/packages/integrations/vercel/src/static/adapter.ts b/packages/integrations/vercel/src/static/adapter.ts index f5e2f63a541a..db6690f8cedf 100644 --- a/packages/integrations/vercel/src/static/adapter.ts +++ b/packages/integrations/vercel/src/static/adapter.ts @@ -24,12 +24,6 @@ export default function vercelStatic(): AstroIntegration { _config = config; }, 'astro:build:start': async ({ buildConfig }) => { - if (String(process.env.ENABLE_VC_BUILD) !== '1') { - throw new Error( - `The enviroment variable "ENABLE_VC_BUILD" was not found. Make sure you have it set to "1" in your Vercel project.\nLearn how to set enviroment variables here: https://vercel.com/docs/concepts/projects/environment-variables` - ); - } - buildConfig.staticMode = true; // Ensure to have `.vercel/output` empty. From 343925b5cd221e02d96403b296b9c4bfadc1702c Mon Sep 17 00:00:00 2001 From: JuanM04 Date: Fri, 22 Jul 2022 10:19:23 -0300 Subject: [PATCH 2/2] Changeset --- .changeset/rotten-candles-count.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/rotten-candles-count.md diff --git a/.changeset/rotten-candles-count.md b/.changeset/rotten-candles-count.md new file mode 100644 index 000000000000..04bd7b77e1e5 --- /dev/null +++ b/.changeset/rotten-candles-count.md @@ -0,0 +1,5 @@ +--- +'@astrojs/vercel': minor +--- + +Removed requirement for `ENABLE_VC_BUILD=1`, since Build Output v3 is now stable. [Learn more](https://vercel.com/blog/build-output-api).