#Use sharp with Bun compilation

1 messages · Page 1 of 1 (latest)

hushed fern
#

When trying to use Sharp in a Bun compiled binary, I'm getting error: Could not load the "sharp" module using the linux-x64 runtime.
Presumably its just a path issue, but I can't figure out if its something I can solve by making sure the correct .node file gets embedded, or if its going to require some changes to Sharp itself.

patent widget
hushed fern
patent widget
#

Yeah!! Can't find sharp

little mortar
#

Yep same issue

#

Works without compilation tho

scenic jay
#

Hey, did someone found a solution?

The problems are this paths that are imported, but it must be imported directly.

const paths = [
  `../src/build/Release/sharp-${runtimePlatform}.node`,
  '../src/build/Release/sharp-wasm32.node',
  `@img/sharp-${runtimePlatform}/sharp.node`,
  '@img/sharp-wasm32/sharp.node'
];

The second problem are the .dll files, that have to be in the same directory