Skip to content

Commit

Permalink
[next] read regions from middleware-manifest output
Browse files Browse the repository at this point in the history
this PR depends on vercel/next.js#40881
  • Loading branch information
Schniz committed Sep 25, 2022
1 parent 6c9164f commit a4892a0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/next/src/utils.ts
Expand Up @@ -2202,6 +2202,7 @@ interface BaseEdgeFunctionInfo {
page: string;
wasm?: { filePath: string; name: string }[];
assets?: { filePath: string; name: string }[];
userConfig?: Record<string, unknown>;
}

interface EdgeFunctionInfoV1 extends BaseEdgeFunctionInfo {
Expand Down Expand Up @@ -2341,6 +2342,11 @@ export async function getMiddlewareBundle({
...wasmFiles,
...assetFiles,
},
regions:
typeof edgeFunction.userConfig === 'object' &&
'regions' in edgeFunction.userConfig
? (edgeFunction.userConfig.regions as any)
: 'auto',
entrypoint: 'index.js',
envVarsInUse: edgeFunction.env,
assets: (edgeFunction.assets ?? []).map(({ name }) => {
Expand Down

0 comments on commit a4892a0

Please sign in to comment.