jimp: Uncaught ReferenceError: regeneratorRuntime is not defined
Expected Behavior
Jimp browser version should load
Current Behavior
Jimp fails to load in browser
Failure Information (for bugs)
index.js?c2d7:3 Uncaught ReferenceError: regeneratorRuntime is not defined
Steps to Reproduce
import Jimp from "jimp/es"
Screenshots NA
Context
Browser, trying to use jimp in @vue-cli project
- Jimp Version:0.8.2
- Operating System: Windows 10
- Node version: 12.10.0
Failure Logs
Uncaught ReferenceError: regeneratorRuntime is not defined
at eval (index.js?c2d7:3)
at Module../node_modules/@jimp/utils/es/index.js (app.js:1259)
at __webpack_require__ (app.js:727)
at fn (app.js:101)
at Module.eval (index.js?67ea:1)
at eval (index.js:1303)
at Module../node_modules/@jimp/core/es/index.js (app.js:855)
at __webpack_require__ (app.js:727)
at fn (app.js:101)
at eval (index.js?0383:1)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 5
- Comments: 28 (12 by maintainers)
Commits related to this issue
- Fix regeneratorRuntime errors (#815) * Fix regeneratorRuntime errors This closes #797 * Fix issues modules false values * fix lint * use links — committed to jimp-dev/jimp by crutchcorn 5 years ago
For anyone finding this in future and still having the issue:
I am also still experiencing this in an electon project with Jimp 0.9.3 (but only when I package the app with electron-builder).
Things I tried from above which didn’t work:
The only thing I have found which did work:
I know that it is a semi-unofficial fork, but however
jimp-compactdependency works vsjimpseems to fix the error…@divinealpine are you able to test again but against
0.8.6-canary.815.502.0?same here, even when using plan js with serverless-webpack downgrading back to 0.6.4 fixes the issue
🚀 Issue was released in v0.9.3 🚀
Fantastic! Thanks for checking @andrewrt! Those warnings should go away once this hits stable IIRC
I updated the import to
import Jimp from "jimp"redeployed and then invoked the lambda function and am receiving the same error message I had above.
@crutchcorn Yep, using typescript.
tsconfig.json:
{ "compilerOptions": { "esModuleInterop": true, "allowSyntheticDefaultImports": true, "sourceMap": true, "target": "es6", "lib": [ "esnext", "dom" ], "moduleResolution": "node" }, "exclude": [ "node_modules" ] }code:
`import Jimp from “jimp/es”
export const doSomething: Handler = (event: APIGatewayEvent, context: Context) => { Jimp.read(‘https://avatars0.githubusercontent.com/u/1192452?s=88&v=4’) .then(image => { console.log(‘doing something’); }) .catch(err => { console.log('handle exception: ', err); }); … } `
More details if helpful: I’m trying to import jimp in a AWS Lambda function. Lambda function runtime is set to nodejs10.x.
Thanks for the feedback, @divinealpine. Can you show me the code you used to do imports and running?
Are you using TypeScript? (if so, what’s your tsconfig.json look like and what version are you using?)
Are you using babel?
@crutchcorn I tried using the version you have here and when I invoke my lambda function with Serverless (aws, serverless, lambda), I get a different error:
{ "errorType": "TypeError", "errorMessage": "Cannot assign to read only property 'exports' of object '#<Object>'", "trace": [ "TypeError: Cannot assign to read only property 'exports' of object '#<Object>'", " at Object.<anonymous> (/var/task/webpack:/node_modules/@jimp/core/es/request.js:34:10)", " at Object.call (/var/task/handler.js:9:283271)", " at r (/var/task/webpack:/webpack/bootstrap:19:22)", " at Module.call (/var/task/handler.js:25:14004)", " at r (/var/task/webpack:/webpack/bootstrap:19:22)", " at Object.call (/var/task/handler.js:9:310475)", " at __webpack_require__ (/var/task/webpack:/webpack/bootstrap:19:22)", " at /var/task/webpack:/webpack/bootstrap:83:10", " at Object.<anonymous> (/var/task/handler.js:1:968)", " at Module._compile (internal/modules/cjs/loader.js:778:30)" ] }@andrewrt @RomainFallet can you test against
0.8.6-canary.815.488.0to confirm a fix? I have tested againstnode-vibrantand it seems to be working for meSame here, thanks to @vanerleo, downgrading to 0.6.4 is my workaround for now.
Related https://github.com/oliver-moran/jimp/pull/783