jimp-dev / jimp-dev/jimp

Custom Jimp does not work on Cloudflare workers, non custom does work

Open
#1,358 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
14.7k
Forks
777
PR merge metrics
No merged PRs in 30d

Description

# Expected Behavior

Expect it to work. I feel like it's probably not a big stretch because things work when you don't try to use a custom Jimp.

# Current Behavior

If I try to make a custom Jimp with:

```js
let Jimp = new Jimp({
formats: [...defaultFormats, webp],
plugins: defaultPlugins,
})
```

I get:

```sh
Uncaught ReferenceError: Buffer is not defined.
```

If I use the default Jimp class like this, then it works fine:

```js
import { Jimp } from "jimp"
```

Buffer is likely a node specific class that needs to be replaced with a standard JS class.

## Steps to Reproduce

Try to make a custom jimp with the code above using the workers SDK.

## Context

- Jimp Version: 1.6.0
- Operating System: Linux

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.