feat: explicit loading of native binaries #127
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.
Proposal to fix: #126
Before this change, the loading of node js binary was fully dynamic.
The proposed way to do this is to explicitly define all binaries that could be loaded. That helps framework that applies tracing on node_modules such as nextjs (when deployed as lambda or standalone) to detect that the binary is in use. It also allows to set a custom message indicating the reason of error.
There's many other ways to achieve the same idea (see esbuild, or sharp with require.resolve), this one keeps the loading as simple possible.
Happy to discuss if it makes sense