From 85873492e724f17b36943d7d97812b214dd7353f Mon Sep 17 00:00:00 2001 From: OJ Kwon <1210596+kwonoj@users.noreply.github.com> Date: Tue, 14 May 2024 11:18:33 -0700 Subject: [PATCH] fext(next-swc): extend internal env flag to all native bindings (#65748) ### What `__INTERNAL_CUSTOM_TURBOPACK_BINDINGS` behaves inconsistent across exposed bindings interface. PR adjusts to apply it to all of the interface, to allow to use this env to override any swc binaries. This is not a public interface, no concern of breaking changes. --- packages/next/src/build/swc/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/next/src/build/swc/index.ts b/packages/next/src/build/swc/index.ts index d8f3907840..8578d8a8b8 100644 --- a/packages/next/src/build/swc/index.ts +++ b/packages/next/src/build/swc/index.ts @@ -97,9 +97,9 @@ const triples = (() => { })() // Allow to specify an absolute path to the custom turbopack binary to load. -// If one of env variables is set, `loadNative` will try to use any turbo-* interfaces from specified -// binary instead. This will not affect existing swc's transform, or other interfaces. This is thin, -// naive interface - `loadBindings` will not validate neither path nor the binary. +// If one of env variables is set, `loadNative` will try to use specified +// binary instead. This is thin, naive interface +// - `loadBindings` will not validate neither path nor the binary. // // Note these are internal flag: there's no stability, feature guarantee. const __INTERNAL_CUSTOM_TURBOPACK_BINDINGS = @@ -1352,7 +1352,7 @@ function loadNative(importPath?: string) { const customBindings = !!__INTERNAL_CUSTOM_TURBOPACK_BINDINGS ? require(__INTERNAL_CUSTOM_TURBOPACK_BINDINGS) : null - let bindings: any + let bindings: any = customBindings let attempts: any[] = [] const NEXT_TEST_NATIVE_DIR = process.env.NEXT_TEST_NATIVE_DIR