-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
pkg packing uneeded build files for native modules #67
Comments
pkg tries to do it's best to guess the files he needs but this is hard to do so I don't see many ways to improve this on pkg side. What you could do is to create a script to do the package and simply move away files before the pkg process and move them back after it finishes |
Don't you think blocked glob patterns could be a nice way to handle this? |
Yeah but I have no time to implement such feature right now. Want to submit a PR? I would call it like |
I can give it a try when I have some times too yes, |
Still have cases with packages using prebuildify packaging the binaries for all platforms instead of just the built platform, should I open another issue about that? |
Actually this is due to https://github.com/yao-pkg/pkg/blob/main/prelude/bootstrap.js#L2235 Reason described in the comment above that line and I think there is no easy fix for that See ref issue: vercel#1075 |
What version of pkg are you using?
5.11.5
What version of Node.js are you using?
18.x
What operating system are you using?
macOS
What CPU architecture are you using?
M2
What Node versions, OSs and CPU architectures are you building for?
any
Describe the Bug
Hello,
I'm trying to optimize how my native modules are loaded into the virtual filesystem.
I know I could use esbuild, but so far I've only came across hacky ways of bundling .node with it, because there are several ways of doing them between bindings, node-gyp, napi-rs...
The way pkg does it seems fair to me and is less likely to create side effects as it follows the same structure as the node_modules folder.
My issue is that for better-sqlite3, that is working well when packaged with pkg, I end up with all the build files (cpp and c) being added in the final VFS. (https://github.com/WiseLibs/better-sqlite3)
If I use the debug command to explore the VFS, this is what I see:
When looking at the debug logs I figured out that the files are being included because when pkg reads the
package.json
it sees this:Expected Behavior
The builds files (.c and .cpp) could be excluded from the final build.
I'm not sure what's the best solution here:
To Reproduce
Create a sample project that uses better-sqlite3 or use our open source project that uses it: https://github.com/Dashlane/dashlane-cli
The text was updated successfully, but these errors were encountered: