Automattic / Automattic/juice

cheerio dependency breaks browserify compatibility since juice@7.0.0

Open
#536 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.3k
Forks
233
Avg merge
1d 10h
Merged PRs (30d)
8

Description

### Summary

Starting with `juice@7.0.0`, the package is no longer browserify-compatible due to changes in the `cheerio` dependency. Up to `juice@6.0.0`, everything works fine in the browser when bundling with Browserify.

### Details

- `juice@6.0.0` uses `cheerio@0.x`, which is CommonJS and compatible with Browserify.
- From `juice@7.0.0` onward, the package depends on `cheerio@1.x`, which:
- Uses ESM
- Requires Node built-ins like `node:stream`
- Fails in Browserify with errors like:
```
Error: Can't walk dependency graph: ENOENT: no such file or directory, lstat '.../node:stream'
```

### Use Case

I'm using Juice to inline CSS for rendering HTML emails in a browser-based email client. This worked great with `juice@6.0.0`, but updating breaks bundling completely.

### Suggested Actions

- Document this breaking change more explicitly in the README and changelog.
- Consider publishing a legacy browser-compatible build or offering an ESM/browser build via `juice/client`.

### Temporary Workaround

Downgrading to `juice@6.0.0` restores Browserify compatibility.

---

Let me know if you're open to a PR, or if there's a preferred way to browserify recent versions.

Contributor guide

Open the contributing guide

Research direction

Reproduce the Browserify dependency-graph failure with juice@7.0.0 and compare it with juice@6.0.0, focusing on the cheerio dependency change. Review the README and changelog requirements, then confirm the project’s preferred resolution for browser compatibility and document the resulting behavior or supported build path.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
build-system, web-dev
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.