Skip to content

Commit 5ed0cfa

Browse files
angwm1claude
andcommitted
fix(web): match css-loader path on Windows for .prefix.css modules
The webpack CSS-rule customization detected css-loader via `use.loader.includes("/css-loader/")`, which only matches POSIX-style paths. On Windows the loader path uses backslashes (`...\node_modules\css-loader\...`), so the check never matched and the `.prefix.css` -> CSS-modules rule (localIdentName `lsf-[local]`) was never inserted. Every `.prefix.css` import then compiled to empty exports ("module has no exports" warnings) and the Data Manager / editor rendered completely unstyled on Windows. Match both separators with `/[\\/]css-loader[\\/]/` so the rule applies on Windows as well as POSIX. No behavior change on POSIX. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 5ed59ee commit 5ed0cfa

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

web/webpack.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ module.exports = composePlugins(
157157
);
158158

159159
const innerTest = oneOfRule.test?.toString() ?? "";
160-
const cssLoader = oneOfRule.use.find((use) => use.loader?.includes("/css-loader/"));
160+
const cssLoader = oneOfRule.use.find((use) => /[\\/]css-loader[\\/]/.test(use.loader ?? ""));
161161

162162
if (innerTest.includes("module") && cssLoader?.options) {
163163
cssLoader.options.modules = {
@@ -173,7 +173,7 @@ module.exports = composePlugins(
173173
rule.oneOf.forEach((oneOfRule, idx) => {
174174
if (!oneOfRule.test || !oneOfRule.use) return;
175175
const t = oneOfRule.test.toString();
176-
if (/^\/\\\.css\$\/$/.test(t) && oneOfRule.use.some((u) => u.loader?.includes("/css-loader/"))) {
176+
if (/^\/\\\.css\$\/$/.test(t) && oneOfRule.use.some((u) => /[\\/]css-loader[\\/]/.test(u.loader ?? ""))) {
177177
insertions.push(idx);
178178
}
179179
});
@@ -183,7 +183,7 @@ module.exports = composePlugins(
183183
const template = rule.oneOf[idx];
184184
const prefixUse = template.use.map((u) => {
185185
if (typeof u === "string") return u;
186-
if (u.loader?.includes("/css-loader/")) {
186+
if (/[\\/]css-loader[\\/]/.test(u.loader ?? "")) {
187187
return {
188188
...u,
189189
options: {

0 commit comments

Comments
 (0)