-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ncc and prebuildify #1183
Comments
There's an integration test here https://github.com/vercel/ncc/blob/main/test/integration/binary-require.js If you're running into a problem, its likely because you're doing dynamic require which can't be statically analyzed easily, something like The partially dynamic case should also work, something like |
Yes, stuff is dynamic. I was able to get around it by adding this: // dummy code for ncc to include the native module
if (process.uptime() < 0) {
require(__dirname + "/../../../prebuilds/darwin-arm64+x64/usearch.node");
require(__dirname + "/../../../prebuilds/linux-arm64/usearch.node");
require(__dirname + "/../../../prebuilds/linux-x64/usearch.node");
require(__dirname + "/../../../prebuilds/win32-ia32/usearch.node");
require(__dirname + "/../../../prebuilds/win32-x64/usearch.node");
require(__dirname + "/../../../build/Release/usearch.node");
} |
Great, I'll close this issue since its working 👍 |
I help maintain a few npm packages. I use prebuildify and prebuild all the versions of the binary .node files. All are included in the npm package itself so no install scripts need run (and the binary files are small anyway). Also, newer things like
bun
don't support lifecycle scripts out of the box, and you have to declare that your trust each one in order to run them.People using ncc don't get the binary .node files however in this scenario.
How can I best alter the various npm packages such that ncc will recognize them, or will it never work because the npm package has binaries for multiple architectures?
The text was updated successfully, but these errors were encountered: