Pin all @swc/core platform binaries as optionalDependencies - #1650
Merged
Conversation
|
Declares every supported @swc/core-* native binary in the root package.json so that package-lock.json records entries for all platforms, not just the one that ran npm install. Without this, contributors and CI runners on a different OS/arch than whoever last regenerated the lockfile hit 'Bindings not found' errors when running the test suite. npm still only installs the binary matching the current platform at install time. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Brian DeHamer <bdehamer@github.com> empty commit
bdehamer
force-pushed
the
bdehamer/swc-cross-platform-bindings
branch
from
May 22, 2026 17:47
17f3181 to
de2a841
Compare
ejahnGithub
approved these changes
May 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Declares every supported
@swc/core-*native binary in the rootpackage.jsonso thatpackage-lock.jsonrecords entries for all platforms, not just the one that rannpm install.Problem
Without this, contributors and CI runners on a different OS/arch than whoever last regenerated the lockfile hit
Bindings not founderrors when running the test suite — every Jest suite fails to transform because@swc/corecan't find a native binary for the current platform.This is a known npm behaviour: a regenerated lockfile only includes the optional dep matching the host platform, even though
@swc/coredeclares all of them asoptionalDependencies.Fix
Add all 9 platform binaries (darwin/linux/win × arm64/x64, plus musl and ia32 variants) as
optionalDependenciesat the root, pinned to the same version (1.5.0) that@swc/jestresolves@swc/coreto. npm still only installs the binary matching the current platform at install time, but every platform's entry is now recorded in the lockfile.Verification
rm -rf node_modules && npm installonly installs@swc/core-darwin-arm64locallypackage-lock.jsonnow contains entries for all 9 platformsnpm test— all 96 suites / 715 tests pass