fix: serve JavaScript assets with a stable MIME type - #6831
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Greptile SummaryThe PR stabilizes the MIME type used for JavaScript static assets so host-specific MIME mappings cannot prevent frontend hydration.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| reflex/utils/precompressed_staticfiles.py | Computes media types from the original asset path and explicitly normalizes JavaScript modules to text/javascript. |
| tests/units/utils/test_precompressed_staticfiles.py | Verifies stable JavaScript MIME handling for identity and gzip responses under an incorrect host MIME mapping. |
| news/6831.bugfix.md | Documents the Windows frontend hydration fix. |
Reviews (2): Last reviewed commit: "chore: add changelog fragment for JavaSc..." | Re-trigger Greptile
Merging this PR will not alter performance
Comparing Footnotes
|
Summary
.jsand.mjsstatic assets astext/javascriptrather than relying on host MIME mappings.jsastext/plainProblem
On Windows, Python reads the
.jscontent type from the registry. If it is registered astext/plain, production Reflex serves ES-module assets with that type, and browsers reject them before the frontend can hydrate.Testing
uv run ruff check reflex/utils/precompressed_staticfiles.py tests/units/utils/test_precompressed_staticfiles.pyuv run pytest tests/units/utils/test_precompressed_staticfiles.py