#15766·rspack

[Bug]: an entry that lists a stylesheet next to a script calls a module the bundle no longer defines (2.2.4+)

Author: cezaraugustoCreated Sep 18, 2026Updated Sep 18, 2026

System Info

macOS arm64, Node 24.18.1, @rspack/core 2.2.3 vs 2.2.6 with the matching @rspack/binding

Details

since 2.2.4 an entry that lists a stylesheet next to a script, ['./src/plain.js', './src/styles.css'], emits a startup that calls the stylesheet's module id, but no factory exists for it, so the bundle throws on load

TypeError: e[249] is not a function

2.2.3 is fine. bisected by swapping only @rspack/core in the same install: 2.2.4, 2.2.5 and 2.2.6 all show it. #14879 made such a stylesheet a CSS-only module, and the bootstrap in rspack_plugin_javascript still walks every entry module. in development mode the stylesheet, being last, also receives the entry's exports object. webpack guards that loop with getModuleSourceTypes(entryModule).has("javascript")

2.2.6 output

javascript
(()=>{"use strict";var e={829(){console.log("page")}};e[829](),e[249]()})();

2.2.3 output

javascript
(()=>{"use strict";var r={249(r){r.exports={}},829(){console.log("page")}},e={};function o(t){...}o(829),o(249)})();

Reproduce link

https://github.com/cezaraugusto/rspack-css-entry-startup

Reproduce Steps

bash
git clone https://github.com/cezaraugusto/rspack-css-entry-startup
cd rspack-css-entry-startup
npm install
npm test

the test builds the same two files with 2.2.3 and 2.2.6 through package aliases, prints both bundles and runs them. config is experiments.css: true, a type: "css" rule and production mode, nothing else