Skip to content

Commit

Permalink
Keep attempting to load binary files after failure (#30755)
Browse files Browse the repository at this point in the history
Multiple binaries may be installed when only one of them will work with
the host machine (limitation of `optionalDependencies`). Failing to
`require` a binary that exists does not necessarily mean there is a
problem with the binary. We need to keep checking if other binaries work.

Fixes #30713



## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
  • Loading branch information
padmaia committed Nov 1, 2021
1 parent 4ac0227 commit a89e651
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/next/build/swc/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ for (const triple of triples) {
} catch (e) {
if (e?.code !== 'MODULE_NOT_FOUND') {
loadError = e
break
}
}
}
Expand All @@ -46,6 +45,8 @@ if (!bindings) {
`Failed to load SWC binary, see more info here: https://nextjs.org/docs/messages/failed-loading-swc`
)
process.exit(1)
} else {
loadError = null
}

async function transform(src, options) {
Expand Down

0 comments on commit a89e651

Please sign in to comment.