[Bug]: Native CSS skips async stylesheet when it is initial in another entry sharing the runtime
System Info
System: Ubuntu 24.04 LTS Node: 24.16.0 pnpm: 12.3.4 Rspack: 2.2.3
Details
With native CSS (type: 'css', parser.exportType: 'link'), multiple entries, optimization.runtimeChunk: 'single', and a shared CSS chunk, a dynamic import can resolve without loading its required stylesheet.
The stylesheet is initial for a different entry in the same compilation. That other entry is not loaded on the current page. The generated shared runtime nevertheless initializes the stylesheet's chunk as loaded in cssInstalledChunks.
It's unclear to me whether this is a known missing feature of the builtin CSS support. It came up for me when I tried to refactor the css-loader out which was archived recently.
Expected behavior
The dynamic import requests the shared stylesheet and waits for it to load before resolving.
Actual behavior
The import resolves without requesting the stylesheet. The CssExtractRspackPlugin control with the same shared runtime works correctly.
Native CSS with a separate runtime per entry also.
Reproduce link
No response
Reproduce Steps
See the attached standalone project and README.
npm ci
npm run build
npm run checkThe last command intentionally exits 1 while the bug is present. For a browser reproduction, run npm run serve, open http://127.0.0.1:8080/native-single/, and click "Load feature" with the Network panel open.
Configuration shape
maindynamically importsfeature.js, which importsfeature.css.otherusesfeature.jsas its entry.- An enforced split-chunk group puts
feature.cssintoshared-css. - Only
main's initial entry assets are included on the page.
Validation
The standalone automated check executes emitted JavaScript with a simulated DOM; it verifies CSS requests and import-promise timing, not browser rendering. The attached project also includes real browser pages for visual confirmation.
Source: web-infra-dev/rspack