docs: use the built-in CSS support of webpack in examples - #609
Merged
Conversation
Rewrite the README examples to rely on `experiments.css` and the `css/auto` module type instead of chaining `style-loader` and `css-loader`, and keep the loader chain setup documented in a dedicated section for anyone who still needs it. Add tests covering the loader with the built-in CSS support of webpack: plain CSS, CSS modules, `url()` handling, source maps, `lessOptions`, `additionalData` and error reporting. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017wwBzDKPnXaC6vFomCtu42
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #609 +/- ##
=======================================
Coverage 96.61% 96.61%
=======================================
Files 2 2
Lines 649 649
=======================================
Hits 627 627
Misses 22 22 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
alexander-akait
added a commit
that referenced
this pull request
Aug 29, 2026
Follow-up to #609. Allow the module `type` of the rule to be configured in the `getCssCompiler` helper and add tests for it: - the `css` type keeps local class names of a `*.module.less` file - the `css/module` type renames local class names of any file - a `Less` warning is reported as a webpack warning Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015mWLDEnMwEUsTLYX1akDLL
alexander-akait
added a commit
that referenced
this pull request
Aug 29, 2026
Follow-up to #609. Allow the module `type` of the rule to be configured in the `getCssCompiler` helper and add tests for it: - the `css` type keeps local class names of a `*.module.less` file - the `css/module` type renames local class names of any file - a `Less` warning is reported as a webpack warning Claude-Session: https://claude.ai/code/session_015mWLDEnMwEUsTLYX1akDLL Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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.
Updates the README examples to webpack's built-in CSS support and adds test coverage for that setup.
Documentation
Every config example now uses
experiments.cssand thecss/automodule type instead of chainingstyle-loaderandcss-loader:The surrounding prose was updated to match, not just the code blocks:
experiments.csshas to be enabled, and links to the loader-chain section for anyone who still needs it.css/autovscssvscss/module.css-loaderandstyle-loadersection keeps the old chain documented.output.cssFilename), and mentionMiniCssExtractPluginonly for the loader-chain path. The deadextract-loaderlink was dropped.url(...)caveat is kept.Tests
New
test/built-in-css.test.js(7 tests), driven by a newtest/helpers/getCssCompiler.jsthat builds a compiler withexperiments.css,type: "css/auto"andoutput.pathinfo: false(so snapshots aren't polluted by webpack's path banner). Coverage:@importresolution (relative and throughnode_modules)url()asset emission and rewritinglessOptionsandadditionalDatapassthrough.lessfile and carries its source contentFixtures live in
test/fixtures/built-in-css/.pathinfowas added to.cspell.json.Notes
testLoader.cjsto capture raw loader output. Converting them would mean asserting against webpack's CSS-parser output rather than less-loader's, which is a weaker assertion, so built-in CSS coverage was added alongside instead of replacing them..module.lessentry rather than a JS entry importing it: Node's test runner treats every.jsfile undertest/as a test file, so a JS fixture importing.lesswould fail as a "test". Narrowing the runner's glob would breaktest:coverage, since Node ignores flags placed after positional patterns.Full test suite and
npm run lint(eslint, cspell, tsc, prettier) pass locally.🤖 Generated with Claude Code
https://claude.ai/code/session_017wwBzDKPnXaC6vFomCtu42
Generated by Claude Code