Skip to content

fix(@angular/build): avoid internal karma request cache for assets #30236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 4, 2025

Conversation

clydin
Copy link
Member

@clydin clydin commented May 2, 2025

The internal karma common middleware that handles requests converts the to be cached data into a string when stored. This can lead to invalid data when the cached string is then sent in a followup request if the original content was not intended to be a string. To avoid this problem, asset files are now explicitly not cached by karma's middleware.
Ref: https://github.com/karma-runner/karma/blob/84f85e7016efc2266fa6b3465f494a3fa151c85c/lib/middleware/common.js#L72

(cherry picked from commit 90d1db3)

Closes #30198

@clydin clydin added the target: patch This PR is targeted for the next patch release label May 2, 2025
@clydin clydin linked an issue May 2, 2025 that may be closed by this pull request
1 task
@clydin clydin requested a review from jkrems May 2, 2025 21:31
@jkrems jkrems added the action: merge The PR is ready for merge by the caretaker label May 4, 2025
@jkrems
Copy link
Contributor

jkrems commented May 4, 2025

This might need a rebase to pick up the CI fix, doesn't look like rerunning the failure picks up the latest merge head.

The internal karma common middleware that handles requests converts
the to be cached data into a string when stored. This can lead to invalid data
when the cached string is then sent in a followup request if the original content
was not intended to be a string. To avoid this  problem, asset files are now
explicitly not cached by karma's middleware.
Ref: https://github.com/karma-runner/karma/blob/84f85e7016efc2266fa6b3465f494a3fa151c85c/lib/middleware/common.js#L72

(cherry picked from commit 90d1db3)
@clydin clydin force-pushed the karma/binary-assets-19.2.x branch from 0aee2ee to 3cb12e2 Compare May 4, 2025 20:45
@clydin clydin merged commit 009fc37 into angular:19.2.x May 4, 2025
30 checks passed
@clydin clydin deleted the karma/binary-assets-19.2.x branch May 4, 2025 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker area: @angular/build target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unit tests using esbuild + Vite fail when reloading using Sqlite wasm
2 participants