handle vercel.json in serverless adapter

This commit is contained in:
Nate Moore 2023-03-13 14:33:08 -05:00
parent 7dd7928003
commit b62e2b4d25

View file

@ -4,6 +4,7 @@ import glob from 'fast-glob';
import { pathToFileURL } from 'url';
import { getVercelOutput, removeDir, writeJson } from '../lib/fs.js';
import { copyDependenciesToFunction } from '../lib/nft.js';
import { getRoutesFromVercelJSON } from '../lib/vercel-config.js';
import { getRedirects } from '../lib/redirects.js';
const PACKAGE_NAME = '@astrojs/vercel/serverless';
@ -106,11 +107,14 @@ export default function vercelServerless({
launcherType: 'Nodejs',
});
const userRoutes = await getRoutesFromVercelJSON(_config)
// Output configuration
// https://vercel.com/docs/build-output-api/v3#build-output-configuration
await writeJson(new URL(`./config.json`, _config.outDir), {
version: 3,
routes: [
...userRoutes,
...getRedirects(routes, _config),
{ handle: 'filesystem' },
{ src: '/.*', dest: 'render' },