You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When installing a package that has sharp as a dependency, then bundling sveltekit project with adapter-node.
Get error running the server :
Error: Could not load the "sharp" module using the darwin-arm64 runtime
undefined: Could not dynamically require "../src/build/Release/sharp-darwin-arm64.node". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.
undefined: Could not dynamically require "../src/build/Release/sharp-wasm32.node". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.
undefined: Could not dynamically require "@img/sharp-darwin-arm64/sharp.node". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.
undefined: Could not dynamically require "@img/sharp-wasm32/sharp.node". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.
After some search I've found that sharp is included in the bundle.
If installing sharp in the sveltekit project directly, sharp is deduped and not include in the bundle.
It's probably not specific to sharp.
As I am making a package for sveltekit that rely on sharp, I'd like that devs who install my package doesn't have to explicitly install sharp to make it work. Or am I missing something ?
Reproduction
git clone [email protected]:bienoubien-studio/adapter-node-sharp.git adapter-node-sharp
cd adapter-node-sharp
cd package
npm install
npm pack
cd ../app
npm install
npm run build
grep -r "sharp" build # looks like it's included
npm preview # work
node build # fail with error
The text was updated successfully, but these errors were encountered:
bienoubien-studio
changed the title
adapter-node includes sharp in bundle even if set to external when dependency of another one...
adapter-node : sharp includes in bundled
Feb 14, 2025
bienoubien-studio
changed the title
adapter-node : sharp includes in bundled
adapter-node : sharp included in bundled
Feb 14, 2025
bienoubien-studio
changed the title
adapter-node : sharp included in bundled
adapter-node : sharp included in bundle
Feb 14, 2025
adapter-node bundles everything in devDependencies and externalizes packages in dependencies. You should be able to use that to not bundle sharp - but people will have to npm ci --omit dev in their deployment environment https://svelte.dev/docs/kit/adapter-node#Deploying
Describe the bug
When installing a package that has sharp as a dependency, then bundling sveltekit project with adapter-node.
Get error running the server :
After some search I've found that sharp is included in the bundle.
If installing sharp in the sveltekit project directly, sharp is deduped and not include in the bundle.
in vite.config.ts (try everything):
It's probably not specific to sharp.
As I am making a package for sveltekit that rely on sharp, I'd like that devs who install my package doesn't have to explicitly install sharp to make it work. Or am I missing something ?
Reproduction
Logs
System Info
Severity
annoyance
Additional Information
No response
The text was updated successfully, but these errors were encountered: