feat(vercel): added warning when ENABLE_FILE_SYSTEM_API=1 is missing (#3139)

* Added warning in buildtime

* Updated readme

* Changeset
This commit is contained in:
Juan Martín Seery 2022-04-18 19:19:46 -03:00 committed by GitHub
parent facf8016e2
commit 4ac3797344
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'@astrojs/vercel': patch
---
Added warning when `ENABLE_FILE_SYSTEM_API` is not found

View file

@ -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!

View file

@ -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