-
-
Notifications
You must be signed in to change notification settings - Fork 760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jimp__WEBPACK_IMPORTED_MODULE_2__.read is not a function from Electron #846
Comments
@zaun , did you find a solution for this? |
@gerbill - Sorry no, I moved on to something else and have't been back to this. |
Jimp would probably use an ESM refresh. If anyone is up for that PR I'll help get it merged and released |
I fixed the module build #1149 |
The module build hasn't solved this issue as I am still experiencing the issue as descriped above with the latest Jimp version. I recently upgraded my react-script from 4 to 5, then I started experiencing this issue. Any help @hipstersmoothie |
Are trying to use jimp in node or browser? esm? |
Can you show me how you're importing jimp? |
Yes, I am importing it like below.
I have also tried other suggestions in this thread such as Making use of it like this to read my image |
Try
|
We're working on browser esm support but this browser version should work for now |
Thanks for your response, still the same error message I am getting. Its not working. Started experiencing this issue only after upgrading my react-scripts from 4 to 5. |
react script might be on an older version of jimp |
I updated my react-script as well as my jimp version also. It seems to be an issue with the changes in webpack 5 that come with the react-script 5. Similar to what this Painterro library maintainer stated here but his supposed fix doesn't work for me. https://hinty.io/devforth/fix-webpack-imported-module-is-not-a-function-for-webpack5/ |
Hello I am also trying jimp in Angular and the error mentioned above is showing also for me: package.json: tsconfig.json |
Browser support is being verified in #1194 |
Facing same Tried everything you've gone thru in this issue, but to no avail. |
I'm facing same problem in react: |
I had a similar issue. It seems as if jimp is exporting the "Jimp" global variable. import "jimp";
Jimp.read(...); works for me |
@mspi92
|
In my case, it shows like this TypeError: Cannot read properties of undefined (reading 'read') |
Any updates on this? |
No updates as I don't look at closed issue very much. If you have a specific issue please open another issue. And if you think you can improve the above issues PRs are always welcome <3 |
I found a way around it. I'm using server actions in Nezt js, meaning that you can also use the old api routes to handle this. This is what the final util looked like:
Mostimes, you dont want users to provide an image url, you would want to hook this up wth some sort of file reader api, right? It's very simple. just create another state that shoud be responsible for updating the url of the currrently selected image.
we can now pass the previewUrl value to the image resize function. works like magic 🪄 |
Works only in dev, once I do a prod build it fails |
has anyone found a permanent solution for this? i cannot run my app using my |
I am also getting the same error,
the following importing jimp helped but gave errors. Here are the error with this import of jimp; for my image from s3 bucket I am getting cors error(jimp related; the image works outside of jimp)
Would love to see a permanent solution for the TypeError, instead of trying to find loopholes to fix it. |
I had to run everything inside a pure node environment, ie outside renderer and did const Jimp = require('jimp'); I didn't have problems after that. The problem though is if you use webpack and your code has node integration true, you need to guess which one works both in dev mode and once again in prod mode. |
Expected Behavior
Read a file from the local filesystem
Current Behavior
Unable to read a file from the local filesystem
Failure Information (for bugs)
Steps to Reproduce
I've setup an Election VUE application using the
vue-cli-plugin-electron-builder
VUE CLI plugin. I'm including Jimp and trying to create a thumbnail.In the Electron background.ts I've got:
Then the code is called I get the above error.
Context
I have my vue.config.js setup with the following web pack information:
Failure Logs
The text was updated successfully, but these errors were encountered: