jimp-dev / jimp-dev/jimp

v1.6.1: Browser dist entry point is an empty stub, breaking all named exports

Open
#1,402 4 comments 22 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

`dist/browser/index.js` should contain the full pre-bundled browser build with all named exports (`Jimp`, `ResizeStrategy`, etc.), as it does in v1.6.0.

# Current Behavior

In v1.6.1, `dist/browser/index.js` is a 3-line stub that exports nothing:

```js
export {};
// A stub. The real build is done by rollup.
//# sourceMappingURL=index-browser.mjs.map
```

Similarly, `dist/browser/index.d.ts` is:

```ts
export {};
//# sourceMappingURL=index-browser.d.mts.map
```

This causes any bundler that resolves the `browser` export condition (e.g. Rollup's `nodeResolve({ browser: true })`, Webpack) to get an empty module. Named imports like `import { Jimp, ResizeStrategy } from "jimp"` silently resolve to `undefined`, causing runtime errors.

# Failure Information (for bugs)

## Steps to Reproduce

1. Install `jimp@1.6.1` (or `jimp@^1.6.0` which resolves to 1.6.1)
2. Use any bundler that respects the `browser` export condition in `package.json` (Rollup with `@rollup/plugin-node-resolve({ browser: true })`, Webpack, Stencil, etc.)
3. Import named exports: `import { Jimp, ResizeStrategy } from "jimp";`
4. The imports resolve to `undefined` because the browser entry point is a stub

**Comparison:**

| File | v1.6.0 | v1.6.1 |
|---|---|---|
| `dist/browser/index.js` | 727KB, 236 lines, full bundle with exports | 98 bytes, stub: `export {};` |
| `dist/browser/index.d.ts` | 116KB, 1764 lines of type declarations | 55 bytes, stub: `export {};` |
| `dist/browser/index.js.map` | 2.9MB | 3.0MB (references full build sources) |

Note that the sourcemap in 1.6.1 references all the expected source files and is actually larger than the 1.6.0 sourcemap — suggesting the full Rollup build ran but its output was not written to `dist/browser/index.js`.

The `package.json` `exports` field still points to the stub:
```json
".": {
"browser": {
"types": "./dist/browser/index.d.ts",
"default": "./dist/browser/index.js"
}
}
```

## Context

- Jimp Version: 1.6.1 (1.6.0 works correctly)
- Operating System: macOS Darwin 25.3.0
- Node version: v24.3.0

## Failure Logs

```
jimp__WEBPACK_IMPORTED_MODULE_2__.ResizeStrategy).BILINEAR
^-- ResizeStrategy is undefined

Attempted import error: 'Jimp' is not exported from 'jimp' (imported as '$hgUW1$Jimp').

```

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.