You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following the docs, I should be able to use Jimp out of the box
Current Behavior
I get a TypeError: Jimp is not a constructor or TypeError: jimp__WEBPACK_IMPORTED_MODULE_1___default(...) is not a constructor error.
Context
When importing Jimp like this: import Jimp from "jimp"
I get TypeError: jimp__WEBPACK_IMPORTED_MODULE_1___default(...) is not a constructor error
I have also tried using it like so var Jimp = require("jimp") but then I get TypeError: Jimp is not a constructor
This is the full code
import _ from "lodash"
import Jimp from "jimp"
class ImageMaker {
static make_money_img(coins, height) {
// var Jimp = require("jimp") <---- tried this as well
let coinwidth = 100
let coinheight = coinwidth * 0.55
let coincount = coins.length
let matrix_width = Math.ceil(coincount / height)
let x = matrix_width
let y = height
let img_w = coinwidth * x
let img_h = coinheight * y
var mainImage = new Jimp(img_w, img_h, 0x0, (err, image) => {
// ... my code here
})
return mainImage.getBase64(Jimp.MIME_PNG)
}
}
export { ImageMaker }
Jimp Version: ^0.22.12
Operating System: Windows 11
Node version: v14.21.3
Failure Logs
The text was updated successfully, but these errors were encountered:
@Marchiuzzz thanks, I got it working with this:
import * as _Jimp from 'jimp';
const Jimp = (typeof self !== 'undefined') ? (self.Jimp || _Jimp) : _Jimp;
Expected Behavior
Following the docs, I should be able to use Jimp out of the box
Current Behavior
I get a
TypeError: Jimp is not a constructor
orTypeError: jimp__WEBPACK_IMPORTED_MODULE_1___default(...) is not a constructor
error.Context
When importing Jimp like this:
import Jimp from "jimp"
I get
TypeError: jimp__WEBPACK_IMPORTED_MODULE_1___default(...) is not a constructor
errorI have also tried using it like so
var Jimp = require("jimp")
but then I getTypeError: Jimp is not a constructor
This is the full code
Failure Logs
The text was updated successfully, but these errors were encountered: