This repository has been archived by the owner on Sep 17, 2024. It is now read-only.
fix(build): enumerate precompiled binaries #146
Merged
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.
Our bindings require call was fully dynamic so bundlers (only tested esbuild and webpack) could not determine the static set of binaries that they need to copy the binaries for, resulting in MODULE_NOT_FOUND runtime error.
This PR fixes this by hardcoding the set of binaries so that they can be copied to the final bundle - the caveat of this approach is that now all precompiled binaries will be copied. Sadly, the approach is not fully forward compatible as missing env/platform/node variants which are not hardcoded will still have to be manually copied.
To ensure we don't break builds by hardcoding binaries and not providing precompiled binaries, I added a step before creating the final npm tarbal which attempts to build a bundle including our profiling package - this triggers .node files to be copied over to outdir folder and errors if any of the hardcoded binaries are not available.