#Cloudflare pages preset

6 messages · Page 1 of 1 (latest)

thick carbon
#

Hi, if I'm hosting my nuxt app in cloudflare, do I need to still set this preset?

  nitro: {
    preset: 'cloudflare-pages',
  },

The reason I ask, is that I want to do some image manipulation in my api route so I'm using sharp but this doesnt seem compatible when I use that preset?

I guess this is out of the realm of here - but - is there another image manipulation library I can do which is compatible with cloudflare pages environment? Thanks

proud herald
#

sharp won't work on cloudflare workers (or most any edge workers)

#

not from what i've been able to figure anyway

gusty shoal
#

I was able to deploy sharp -- see issues comment: https://github.com/lovell/sharp/issues/4113#issuecomment-2560374164

But now I'm getting some runtime errors so I need to figure that out:

Could not load the \"sharp\" module using the linuxnull-undefined runtime\nundefined: Could not dynamically require \"../src/build/Release/sharp-linuxnull-undefined.node\". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.\nundefined: 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.\nundefined: Could not dynamically require \"@img/sharp-linuxnull-undefined/sharp.node\". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.\nundefined: 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.\nPossible solutions:\n- Manually install libvips >= 8.15.3\n- Add experimental WebAssembly-based dependencies:\n    npm install --cpu=wasm32 sharp\n    npm install @img/sharp-wasm32\n- Consult the installation documentation:\n    See https://sharp.pixelplumbing.com/install\n"
GitHub

Possible bug Is this a possible bug in a feature of sharp, unrelated to installation? Running npm install sharp completes without error. Running node -e "require('sharp')" complet...

proud herald