Skip to content

Commit 3da3dfc

Browse files
justin808claude
andcommitted
Fix server bundle to properly filter Rspack CSS extract loader
The server config was only checking for 'mini-css-extract-plugin' but Rspack uses 'cssExtractLoader.js'. This caused the CSS extract loader to remain in the server bundle, which breaks CSS modules exports in SSR. Added check for 'cssExtractLoader' to properly remove it from server bundle, ensuring CSS modules work correctly in server-side rendering. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 28014b2 commit 3da3dfc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

config/rspack/serverRspackConfig.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ const configureServer = () => {
7171
const rules = serverRspackConfig.module.rules;
7272
rules.forEach((rule) => {
7373
if (Array.isArray(rule.use)) {
74-
// remove the mini-css-extract-plugin and style-loader
74+
// remove the mini-css-extract-plugin/CssExtractRspackPlugin and style-loader
7575
rule.use = rule.use.filter((item) => {
7676
let testValue;
7777
if (typeof item === 'string') {
7878
testValue = item;
7979
} else if (typeof item.loader === 'string') {
8080
testValue = item.loader;
8181
}
82-
return !(testValue.match(/mini-css-extract-plugin/) || testValue === 'style-loader');
82+
return !(testValue?.match(/mini-css-extract-plugin/) || testValue?.includes('cssExtractLoader') || testValue === 'style-loader');
8383
});
8484
const cssLoader = rule.use.find((item) => {
8585
let testValue;

0 commit comments

Comments
 (0)