From 4ac3797344943df4124abd4043deda624440f035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Seery?= Date: Mon, 18 Apr 2022 19:19:46 -0300 Subject: [PATCH] feat(vercel): added warning when `ENABLE_FILE_SYSTEM_API=1` is missing (#3139) * Added warning in buildtime * Updated readme * Changeset --- .changeset/soft-fishes-switch.md | 5 +++++ packages/integrations/vercel/README.md | 2 +- packages/integrations/vercel/src/index.ts | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .changeset/soft-fishes-switch.md diff --git a/.changeset/soft-fishes-switch.md b/.changeset/soft-fishes-switch.md new file mode 100644 index 000000000000..bd64852e806c --- /dev/null +++ b/.changeset/soft-fishes-switch.md @@ -0,0 +1,5 @@ +--- +'@astrojs/vercel': patch +--- + +Added warning when `ENABLE_FILE_SYSTEM_API` is not found diff --git a/packages/integrations/vercel/README.md b/packages/integrations/vercel/README.md index 7b8aae035f0a..4b63aed0185b 100644 --- a/packages/integrations/vercel/README.md +++ b/packages/integrations/vercel/README.md @@ -13,7 +13,7 @@ export default defineConfig({ }); ``` -After you build your site the `.output/` folder will contain your server-side rendered app. Since this feature is still in beta, you'll **need to add this Enviroment Variable to your Vercel project**: `ENABLE_FILE_SYSTEM_API=1` +After you build your site the `.output/` folder will contain your server-side rendered app. Since this feature is still in beta, you'll **need to add this Enviroment Variable to your Vercel project**: `ENABLE_FILE_SYSTEM_API=1`. [Learn how to set enviroment variables](https://vercel.com/docs/concepts/projects/environment-variables). Now you can deploy! diff --git a/packages/integrations/vercel/src/index.ts b/packages/integrations/vercel/src/index.ts index 6c353a93dbee..439eeeb04ce2 100644 --- a/packages/integrations/vercel/src/index.ts +++ b/packages/integrations/vercel/src/index.ts @@ -53,6 +53,12 @@ export default function vercel(): AstroIntegration { buildConfig.serverEntry = `${ENTRYFILE}.js`; buildConfig.client = new URL('./static/', _config.outDir); buildConfig.server = new URL('./server/pages/', _config.outDir); + + if (String(process.env.ENABLE_FILE_SYSTEM_API) !== '1') { + console.warn( + `The enviroment variable "ENABLE_FILE_SYSTEM_API" 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` + ); + } }, 'astro:build:done': async ({ routes }) => { // Bundle dependecies