Skip to content

fix: match css-loader path on Windows so .prefix.css compiles as CSS modules#9781

Open
angwm1 wants to merge 1 commit into
HumanSignal:developfrom
angwm1:fix/windows-css-loader-path
Open

fix: match css-loader path on Windows so .prefix.css compiles as CSS modules#9781
angwm1 wants to merge 1 commit into
HumanSignal:developfrom
angwm1:fix/windows-css-loader-path

Conversation

@angwm1

@angwm1 angwm1 commented Jun 17, 2026

Copy link
Copy Markdown

Description

On Windows the production frontend build leaves the Data Manager and editor completely unstyled, because their .prefix.css files are not compiled as CSS modules.

Root cause

In web/webpack.config.js, the CSS-rule customization detects the css-loader with:

use.loader?.includes("/css-loader/")

This only matches POSIX-style loader paths. On Windows the resolved loader path uses backslashes (...\node_modules\css-loader\...), so the check never matches. As a consequence:

  • the .module.css modules options block is skipped, and
  • the dedicated .prefix.css → CSS-modules rule (localIdentName: "lsf-[local]") is never inserted.

Every .prefix.css import (import styles from "./X.prefix.css") then resolves to an empty module, producing build warnings like:

export 'default' (imported as 'styles') was not found in './Taxonomy.prefix.css' (module has no exports)

and styles.foo becomes undefined, so no class names are applied — the Data Manager and editor render with no styling.

Fix

Match both path separators when detecting css-loader:

/[\\/]css-loader[\\/]/.test(use.loader ?? "")

Applied to all three occurrences. No behavior change on POSIX; on Windows the .prefix.css CSS-modules rule is now inserted as intended.

Verification

  • Before: webpack compiled with 7 warnings (all *.prefix.css "module has no exports"); Data Manager unstyled.
  • After: webpack compiled successfully (0 such warnings); served main.css now contains the lsf--prefixed classes (e.g. .lsf-datamanager { height: ... }) and the Data Manager renders styled.

Built on Windows 11 with Node 24 / yarn (yarn ls:build).

🤖 Generated with Claude Code

@netlify

netlify Bot commented Jun 17, 2026

Copy link
Copy Markdown

👷 Deploy request for label-studio-docs-new-theme pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 5ed0cfa

@netlify

netlify Bot commented Jun 17, 2026

Copy link
Copy Markdown

👷 Deploy request for heartex-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 5ed0cfa

@netlify

netlify Bot commented Jun 17, 2026

Copy link
Copy Markdown

Deploy Preview for label-studio-storybook canceled.

Name Link
🔨 Latest commit 5ed0cfa
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-storybook/deploys/6a32141626430900087119ca

@netlify

netlify Bot commented Jun 17, 2026

Copy link
Copy Markdown

Deploy Preview for label-studio-playground canceled.

Name Link
🔨 Latest commit 5ed0cfa
🔍 Latest deploy log https://app.netlify.com/projects/label-studio-playground/deploys/6a321416de338c0007618a4b

@angwm1 angwm1 changed the title fix(web): match css-loader path on Windows so .prefix.css compiles as CSS modules fix: match css-loader path on Windows so .prefix.css compiles as CSS modules Jun 17, 2026
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>
@angwm1 angwm1 force-pushed the fix/windows-css-loader-path branch from 52da4af to 5ed0cfa Compare June 17, 2026 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant