fix(deploy): skip dist/assets/js in minify-dist to keep Vite/esbuild bundles intact#2456
Merged
Merged
Conversation
Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/ccf2fe73-be7d-4ba8-99a8-b878f1fbf6ee Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
…ashboards Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/ccf2fe73-be7d-4ba8-99a8-b878f1fbf6ee Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
pethers
May 13, 2026 10:13
View session
Contributor
🏷️ Automatic Labeling SummaryThis PR has been automatically labeled based on the files changed and PR metadata. Applied Labels: testing,refactor,size-m Label Categories
For more information, see |
Contributor
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a deploy-time regression where scripts/minify-dist.ts re-minified Vite/esbuild output under dist/assets/js/, and coderaiser/minify (@putout/minify) could miscompile certain comma-expression var initializers (observed in the PapaParse chunk), producing invalid JavaScript that broke all CIA dashboards.
Changes:
- Update
scripts/minify-dist.tsto skip theassets/jssubtree (Vite/esbuild bundles) during the deploy minify pass. - Add a Vitest regression test ensuring
assets/js/*bundles remain byte-identical while authored JS outside that subtree is still minified.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| scripts/minify-dist.ts | Adds assets/js to SKIP_SUBPATHS so Vite/esbuild output is never re-minified by coderaiser/minify. |
| tests/css-purge-and-minify.test.ts | Adds a regression test proving assets/js is skipped (PapaParse pattern) while other JS files are still minified. |
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.
All 9 CIA dashboards on every language hub broke with
SyntaxError: Unexpected token 'this'after the deploy-timeminify-distpass corruptedassets/js/papa-*.js.coderaiser/minify(→@putout/minify) strips the outer parens of a comma-expression initializer in avardeclarator, turning valid esbuild output into invalid JS:The broken
papa-*.jsmodule then fails to parse, taking down every chunk that imports it (cia-entry on the hub plus every lazy-loaded*-dashboard-*.js).Changes
scripts/minify-dist.ts— addassets/jstoSKIP_SUBPATHS. Vite already minifies these chunks with esbuild (build.minify: 'esbuild'); re-runningcoderaiser/minifyyields zero compression and corrupts them. Authored static JS underdist/js/(back-to-top, theme-toggle) is unaffected.tests/css-purge-and-minify.test.ts— regression test using the exact failing PapaParse pattern as fixture; asserts the bundle is byte-identical afterminifyRunwhile a sibling authored JS file outside the skip subtree still shrinks.Verification
vite build+tsx scripts/minify-dist.ts distleavesdist/assets/js/papa-*.jsbyte-identical (MD5 unchanged) and@babel/parserparses it cleanly. Pipeline log confirms scope:.js: 3 files, 17.7 KiB → 4.5 KiB— only the 3 authored static files outsideassets/js/are minified.