Skip to content

[6.x] Keep marked and DOMPurify out of the front-end helpers bundle - #15174

Merged
jasonvarga merged 1 commit into
statamic:6.xfrom
lazerg:fix/issue-15173-frontend-bundle-size
Aug 12, 2026
Merged

[6.x] Keep marked and DOMPurify out of the front-end helpers bundle#15174
jasonvarga merged 1 commit into
statamic:6.xfrom
lazerg:fix/issue-15173-frontend-bundle-size

Conversation

@lazerg

@lazerg lazerg commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

The front-end helpers.js bundle ships all of marked and dompurify. It only exposes $conditions and $passkeys, and neither of those paths renders Markdown or sanitizes HTML, so every visitor downloads two libraries the page can never call.

They arrive through a single import. field-conditions/Validator.js takes data_get from bootstrap/globals.js, and globals.js also imports util/markdown.js, which brings in both. Neither library declares sideEffects: false and both instantiate at module scope, so the bundler has to keep them.

This moves data_get into its own module and points Validator.js there. globals.js re-exports it, so nothing else needed touching. The built file drops from 99,546 bytes to 28,190 (30,692 to 8,411 gzipped) with the same two exports intact.

Fixes #15173

@jasonvarga
jasonvarga merged commit 141882a into statamic:6.x Aug 12, 2026
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants