feat(vercel): Edge improvements (#5086)

* Added error on "output" == "static"

* Minify output

* Changeset
This commit is contained in:
Juan Martín Seery 2022-10-14 17:17:13 -03:00 committed by GitHub
parent ddfbef5acb
commit f8198d2502
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
'@astrojs/vercel': minor
---
Minify Edge Function output to save space

View file

@ -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) {
@ -66,6 +73,9 @@ export default function vercelEdge(): AstroIntegration {
target: 'webworker',
noExternal: true,
};
vite.build ||= {};
vite.build.minify = true;
}
},
'astro:build:done': async ({ routes }) => {