Closed zachzafar closed 1 year ago
me, too, fuck
If you are trying to composite images theres a library I used called ‘merge-images’ that works quite fine instead of jimp
If you are trying to composite images theres a library I used called ‘merge-images’ that works quite fine instead of jimp
I solved this problem, which was very ridiculous, I commented related codes in "jimp/core/dist/request.js" and "jimp/core/es/request.js" that lines include the variable "process".
From the error stack containing …/@jimp/core/es/…
, I assume that you are using jimp
or jimp/es
in your imports. In React, I use the browser version of Jimp:
await import("jimp/browser/lib/jimp.js"); // This statement loads the browser version of Jimp and makes it available as the global variable `window.Jimp`.
const { Jimp } = window as typeof window & { Jimp: any }; // any can probably be replaced with something else from the Jimp package
Hmm how could we solve this in a way so that you can use the es version but we still have env vars
process
is no longer referenced in this module since https://github.com/jimp-dev/jimp/pull/1165/files#diff-b006a5b348be759a61096ee2df4a193a6e822bfaee285593ed0dc242c2acef9f. This particular issue should be fixed
React app should display
Current Behavior
App is compiled successfuly however the app does not display and the following error is logged to the console in the browser
Failure Information (for bugs)
request.js:3 Uncaught ReferenceError: process is not defined at ./node_modules/@jimp/core/es/request.js (request.js:3:1) at options.factory (react refresh:6:1) at webpack_require__ (bootstrap:24:1) at fn (hot module replacement:62:1) at ./node_modules/@jimp/core/es/index.js (index.js:12:1) at options.factory (react refresh:6:1) at webpack_require__ (bootstrap:24:1) at fn (hot module replacement:62:1) at ./node_modules/@jimp/custom/es/index.js (index.js:1:1) at options.factory (react refresh:6:1)
Steps to Reproduce
create a function.js file where we will create a function called imageGenerator that uses jimp
import that function in a react component to be used in another function
Failure Logs