From a8d414755454eaa50e031b8067bc43dadfc72726 Mon Sep 17 00:00:00 2001 From: Gal Schlezinger Date: Tue, 12 Jul 2022 09:33:14 +0300 Subject: [PATCH] [next] Add EdgeRuntime provider environment variable to the builder (#8130) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will enable Next.js to compile and set `vercel` as the edge runtime provider (`EdgeRuntime` global), which can allow different libraries/customers to have different code running depends on the runtime environment (`edge-runtime` vs `vercel`). ### Related Issues - https://github.com/vercel/next.js/pull/38331 ### 📋 Checklist #### Tests The Next.js feature was not merged yet, so it still can't be tested. - [ ] The code changed/added as part of this PR has been covered with tests - [ ] All tests pass locally with `yarn test-unit` #### Code Review - [ ] This PR has a concise title and thorough description useful to a reviewer - [ ] Issue from task tracker has a link to this PR --- packages/next/src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/next/src/index.ts b/packages/next/src/index.ts index e5d71be9f3d..b67eff635ae 100644 --- a/packages/next/src/index.ts +++ b/packages/next/src/index.ts @@ -399,6 +399,7 @@ export const build: BuildV2 = async ({ const env: typeof process.env = { ...spawnOpts.env }; const memoryToConsume = Math.floor(os.totalmem() / 1024 ** 2) - 128; env.NODE_OPTIONS = `--max_old_space_size=${memoryToConsume}`; + env.NEXT_EDGE_RUNTIME_PROVIDER = 'vercel'; if (target) { // Since version v10.0.8-canary.15 of Next.js the NEXT_PRIVATE_TARGET env