Skip to content

Commit

Permalink
fix(next-swc): load wasm fallback if native bindings fail to load (#6…
Browse files Browse the repository at this point in the history
…5623)

### What

This PR fixes regressions introduced at
https://github.com/vercel/next.js/pull/57437/files#diff-907b7be0cfc75bd37773e5ebc38d1deffa40861b8ac1cde92e4992e284a1ee59L245,
which removes to try load wasm fallback if 1. platform is supported 2.
fail to load native bindings for some reason.
  • Loading branch information
kwonoj committed May 10, 2024
1 parent 2c53133 commit 5fb2656
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/next/src/build/swc/index.ts
Expand Up @@ -274,6 +274,14 @@ export async function loadBindings(
attempts = attempts.concat(a)
}

// For these platforms we already tried to load wasm and failed, skip reattempt
if (!shouldLoadWasmFallbackFirst && !disableWasmFallback) {
const fallbackBindings = await tryLoadWasmWithFallback(attempts)
if (fallbackBindings) {
return resolve(fallbackBindings)
}
}

logLoadFailure(attempts, true)
})
return pendingBindings
Expand Down

0 comments on commit 5fb2656

Please sign in to comment.