Repository navigation
Bump htmx to 2.0 and minify the frontend bundle - #243
Merged
Merged
Conversation
Bensge
force-pushed
the
chore/htmx-2
branch
from
September 13, 2026 08:50
30615f3 to
8a60d4b
Compare
htmx 2's dist/htmx.min.js is a bare `var htmx = ...` with no UMD wrapper, so bundled into our IIFE it never reaches window.htmx and the inline `htmx.trigger(document.body, 'passkeys_changed')` in Profile.kte would break. main.js now imports the ESM build and assigns window.htmx itself, like it already does for passkeys, and modal.js imports htmx instead of relying on the ambient global. The ESM build is unminified and nothing compresses responses (no Caddy encode, no Spring compression), which would have added ~130 KB to every uncached page load. Adding @rollup/plugin-terser minifies the whole bundle instead - it was never minified beyond what the vendored *.min.js files brought along - and main.js ends up smaller than before (719 KB vs 742 KB). Nothing else in the htmx 1->2 migration guide applies: both hx-delete routes use path variables (DELETE params moved to the URL), CSRF goes through hx-headers, there is no hx-on, no extension, and every request is same-origin (selfRequestsOnly now defaults to true). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Bensge
force-pushed
the
chore/htmx-2
branch
from
September 13, 2026 08:56
8a60d4b to
0c86f02
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces Dependabot's #235 with a hand-made bump, because htmx 2 needs one code change that the Dependabot PR can't know about. Stacked on #242 so the new Frontend bundle check runs on it; GitHub will retarget this PR to
masteronce #242 merges.The break: htmx 2's
dist/htmx.min.jsis a barevar htmx = (function(){…})()— no UMD wrapper, nowindow.htmx. Bundled into our rollup IIFE thatvaris bundle-local, sowindow.htmxdisappears and the inlinehtmx.trigger(document.body, 'passkeys_changed')inProfile.kte(after "Add a passkey") would throw.main.js:import htmx from 'htmx.org'(the ESM build) andwindow.htmx = htmx, same pattern aswindow.passkeys.modal.js: importshtmxexplicitly instead of relying on the ambient global.rollup.config.mjs: adds@rollup/plugin-terser. The ESM build is unminified and nothing compresses responses (noencodein the Caddyfile, no Spring compression), which would have cost ~130 KB per uncached load. Minifying the whole bundle — it never was, beyond the vendored*.min.jsfiles — bringsmain.jsto 719 KB, down from 742 KB before the bump.Checked against the htmx 1→2 migration guide — nothing else applies: both
hx-deletes use path variables (DELETE params now go in the URL), CSRF is sent viahx-headers, nohx-on, no extensions, every request is same-origin (selfRequestsOnlydefault flipped totrue), andscrollBehavior's new default only affects boosted links (none).Test plan
npm ci && npm run packagebundles; output containswindow.htmx=and htmxversion:"2.0.10"/profile: add a passkey → list refreshes (thehtmx.triggerpath); delete a passkey; add + delete a Steam ID (modal open/close,hx-delete)/namegen: like button (hx-post+HX-Triggerheader refresh)/: live fragment keeps polling every 10 s; activity chart loads on scroll (intersect once)Closes #235.
🤖 Generated with Claude Code