Skip to content

Commit

Permalink
feat(vercel): Edge improvements (#5086)
Browse files Browse the repository at this point in the history
* Added error on "output" == "static"

* Minify output

* Changeset
  • Loading branch information
JuanM04 authored Oct 14, 2022
1 parent ddfbef5 commit f8198d2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/hot-dogs-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/vercel': minor
---

Minify Edge Function output to save space
10 changes: 10 additions & 0 deletions packages/integrations/vercel/src/edge/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ export default function vercelEdge(): AstroIntegration {
_config = config;
serverEntry = config.build.serverEntry;
functionFolder = config.build.server;

if (config.output === 'static') {
throw new Error(`
[@astrojs/vercel] \`output: "server"\` is required to use the edge adapter.
`);
}
},
'astro:build:start': ({ buildConfig }) => {
if (needsBuildConfig) {
Expand Down Expand Up @@ -66,6 +73,9 @@ export default function vercelEdge(): AstroIntegration {
target: 'webworker',
noExternal: true,
};

vite.build ||= {};
vite.build.minify = true;
}
},
'astro:build:done': async ({ routes }) => {
Expand Down

0 comments on commit f8198d2

Please sign in to comment.