-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Hello!
Thank you for developing the wonderful Sharp library.
I am currently using pnpm in my project, and while checking the lifecycle script,
I need some information to decide whether to allow Sharp's postinstall.
I have a question about one point.
I think sharp uses node-gyp during installation to rebuild the C# main body into wasm format using emscripten.
Line 95 in 8607ff2
| "install": "node install/check.js", |
Line 27 in 8607ff2
| const status = spawnRebuild(); |
Line 126 in 8607ff2
| spawnSync(`node-gyp rebuild --directory=src ${isEmscripten() ? '--nodedir=emscripten' : ''}`, { |
This means rebuilding all WASM files for each cross-platform. Is that correct?
Strictly speaking, I understand that it regenerates wasm corresponding to all packages under the src directory.
Furthermore, if that understanding is correct, there is a question.
For example, let's look at @img/sharp-darwin-arm64.
If you check the npm code, you will see that it contains lib/sharp-darwin-arm64.node.
My understanding is that the wasm output is included in the package.
https://www.npmjs.com/package/@img/sharp-darwin-arm64?activeTab=code
However, I don't understand why it needs to be rebuilt again during installation. Could you please explain?🙇♂️
This is just my guess, but I think they are rebuilding to generate the optimal wasm for each execution environment's runtime. Is that correct?