Skip to content

Commit

Permalink
fext(next-swc): extend internal env flag to all native bindings (verc…
Browse files Browse the repository at this point in the history
…el#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.
  • Loading branch information
kwonoj authored and panteliselef committed May 20, 2024
1 parent 5b00357 commit 6c02293
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/next/src/build/swc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6c02293

Please sign in to comment.