Skip to content

Commit

Permalink
feat(vercel): added warning when ENABLE_FILE_SYSTEM_API=1 is missing (
Browse files Browse the repository at this point in the history
#3139)

* Added warning in buildtime

* Updated readme

* Changeset
  • Loading branch information
JuanM04 authored Apr 18, 2022
1 parent facf801 commit 4ac3797
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/soft-fishes-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/vercel': patch
---

Added warning when `ENABLE_FILE_SYSTEM_API` is not found
2 changes: 1 addition & 1 deletion packages/integrations/vercel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!

Expand Down
6 changes: 6 additions & 0 deletions packages/integrations/vercel/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4ac3797

Please sign in to comment.