fix: match css-loader path on Windows so .prefix.css compiles as CSS modules#9781
Open
angwm1 wants to merge 1 commit into
Open
fix: match css-loader path on Windows so .prefix.css compiles as CSS modules#9781angwm1 wants to merge 1 commit into
angwm1 wants to merge 1 commit into
Conversation
👷 Deploy request for label-studio-docs-new-theme pending review.Visit the deploys page to approve it
|
👷 Deploy request for heartex-docs pending review.Visit the deploys page to approve it
|
✅ Deploy Preview for label-studio-storybook canceled.
|
✅ Deploy Preview for label-studio-playground canceled.
|
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>
52da4af to
5ed0cfa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
On Windows the production frontend build leaves the Data Manager and editor completely unstyled, because their
.prefix.cssfiles are not compiled as CSS modules.Root cause
In
web/webpack.config.js, the CSS-rule customization detects the css-loader with: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:.module.cssmodules options block is skipped, and.prefix.css→ CSS-modules rule (localIdentName: "lsf-[local]") is never inserted.Every
.prefix.cssimport (import styles from "./X.prefix.css") then resolves to an empty module, producing build warnings like:and
styles.foobecomesundefined, so no class names are applied — the Data Manager and editor render with no styling.Fix
Match both path separators when detecting css-loader:
Applied to all three occurrences. No behavior change on POSIX; on Windows the
.prefix.cssCSS-modules rule is now inserted as intended.Verification
webpack compiled with 7 warnings(all*.prefix.css"module has no exports"); Data Manager unstyled.webpack compiled successfully(0 such warnings); servedmain.cssnow contains thelsf--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