lovell / sharp

High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library.
https://sharp.pixelplumbing.com
Apache License 2.0
29.33k stars 1.3k forks source link

App loading issue while using Sharp in React Native App #4205

Closed dsriny closed 2 months ago

dsriny commented 2 months ago

sharp 0.33.5 Node.js v18.20.4

used in mobile react native component by importing sharp library and calling sharp functions await sharp()

Does sharp supports for above node ? If yes then what could be reason for this errors, did couple of things to resolve

Errors

node_modules/sharp/lib/constructor.js: node:util could not be found within the project or in these directories: node_modules/sharp/node_modules node_modules ../node_modules ../../node_modules ../../../node_modules 4 | 'use strict'; 5 |

6 | const util = require('node:util'); | ^ 7 | const stream = require('node:stream'); 8 | const is = require('./is'); 9 |]

lovell commented 2 months ago

Please see https://github.com/lovell/sharp/issues/2229#issuecomment-635330403

dsriny commented 2 months ago

Thanks @lovell Got it, this libray is not supported for React Native