Empty styles-generic-layout CSS file is emitted and linked as a render-blocking stylesheet
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- css, javascript
- Domain
- build-system, frontend
Research direction
Start with components/outer-layout/utils.js, where stylesForComponents adds every CSS asset of an entry without checking size, and with the styles-generic-layout entry in rspack.config.js that splitChunks leaves empty. Reproduce by building and checking that out/ holds a 0-byte styles-generic-layout.<hash>.css. Done when that file is no longer emitted or linked, and pages still load 270.<hash>.css for the sidebar layout.
Written by the indexing model from the issue text.
Description
What information was incorrect, unhelpful, or incomplete?
The build emits an empty (0-byte) stylesheet, static/client/styles-generic-layout.<hash>.css, and pages using the generic layout still link it with fetchpriority="high", followed by a <script></script>, so browsers make a render-blocking request for an empty file.
Cause:
components/generic-layout/server.cssonly contains@import url("../layout/2-sidebars.css");.rspack.config.jsturns eachcomponents/*/server.cssinto astyles-<dir>entry, andsplitChunksmoves the shared2-sidebars.css(also imported bycomponents/curriculum/layout.cssandcomponents/reference-layout/server.css) into a shared chunk (270.<hash>.css).- The
styles-generic-layoutCSS chunk is left without modules, but is still emitted as an empty file and listed in the entrypoint's assets instats.json. stylesForComponents(components/outer-layout/utils.js) adds every CSS asset of the entry without checking its size.
What did you expect to see?
No empty stylesheet emitted or linked; pages only link 270.<hash>.css for the sidebar layout.
Do you have any supporting links, references, or citations?
Found while testing a new uploader for the test environment, which rejected the empty body (411 Length Required): https://github.com/mdn/dex/actions/runs/43436975451
Do you have anything more you want to share?
It is the only 0-byte file among the ~344k files in out/. Pages linking it include /en-US/mcp, /en-US/observatory/docs/faq, /en-US/observatory/docs/tests_and_scoring, /en-US/plus/docs/faq and /en-US/plus/docs/features/*.
Possible fixes:
- Skip zero-size CSS assets in
stylesForComponents, which also covers future components whose CSS is fully hoisted into a shared chunk. - Or avoid the empty entry, e.g. by not making
generic-layouta style entry, or by moving the shared layout CSS into a named cache group.
- Dominant language
- JavaScript
- Stars
- 242
- Forks
- 66
- Avg merge
- 1d 2m
- Merged PRs (30d)
- 49
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mdn/fred
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Overlapping icons on Github menu linkPossibly taken @danielhjacobs claimed this 71 days ago. Openp1
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Skip Link: Pressing "Tab" after activating "Skip to main content" returns focus to the top of the page in FirefoxPossibly taken @caugner claimed this 51 days ago. Openp1
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
mdn/fred#1726 · 3 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
p1
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
needs triage
Difficulty 4/5 3-5 days Newbie friendliness 52/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Area/DeveloperPortal Aspect/UI Severity/Minor Type/Bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
wso2/api-platform#4369 ·
Maintainers usually reply within 1 day
-
Own-agent checks: reject the Actions bot id in admit.mjs and test the source label in pr-verifyOpen
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
melodic-software/claude-code-plugins#17374 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
keyxmakerx/Chronicle#2284 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
soroswap/token-list#125 ·
Maintainers usually reply within 1 day