docs: use the built-in CSS support of webpack in examples - #1336
Merged
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1336 +/- ##
=======================================
Coverage 96.67% 96.67%
=======================================
Files 2 2
Lines 901 901
=======================================
Hits 871 871
Misses 30 30 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Replace the `style-loader`/`css-loader` chains in the README examples with webpack's built-in CSS support (`experiments.css` and the `css/auto` module type), keeping the loader-based setup documented as an alternative. Add the built-in CSS support as the first recommended way to extract stylesheets. Cover the documented setup with tests: `getCompiler` can now build with `experiments.css` enabled and `css/auto` (without the test loader), and new tests assert the emitted CSS and its source map. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013PtW7eezwuQP5epLFMrAky
alexander-akait
force-pushed
the
claude/webpack-css-examples-tests-gn9qbl
branch
from
August 29, 2026 12:22
03481e1 to
ffa01b8
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.
Updates the README examples to use webpack's built-in CSS support (
experiments.css+ thecss/automodule type) instead of chainingstyle-loaderandcss-loader, and covers that setup with tests.Docs
type: "css/auto"on the rule andexperiments: { css: true }, withstyle-loader/css-loaderremoved from theusearrays (11 examples, including the two source-map examples that also passedsourceMaptocss-loader).style-loader/css-loaderchain documented as the alternative for anyone on that setup.output.cssFilename/cssChunkFilename);mini-css-extract-plugin, Asset Modules,extract-loaderandfile-loaderare kept and renumbered 2–5.url(...)and source-map prose now refers to webpack handling the generated CSS rather than tocss-loaderspecifically.Tests
test/helpers/getCompiler.jsacceptscss: true, which enablesexperiments.css, setstype: "css/auto", swapsoutput.libraryforoutput.cssFilename, and drops the test loader, since webpack consumes the loader result itself. Aconfig.experimentspassthrough was added too.test/helpers/getCodeFromCssBundle.jsreads the emitted CSS asset.test/loader.test.js: "should work with the built-in CSS support of webpack" for all four implementation/API combinations across both syntaxes. The snapshots also show webpack's CSS pipeline resolving the@import "./file.css"in the fixture.test/sourceMap-options.test.js: "should generate source maps with the built-in CSS support of webpack", asserting the emittedmain.bundle.css.map.Verification
npm run test:basepasses; snapshot regeneration only added entries, the existing snapshots are unchanged.npm run lint(eslint, cspell,tsc --noEmit, prettier) is clean.No changeset is included, as this only touches documentation and tests without any runtime change.
🤖 Generated with Claude Code
https://claude.ai/code/session_013PtW7eezwuQP5epLFMrAky
Generated by Claude Code