Skip to content

test: add missing CSS test cases inspired by css-loader and mini-css-extract-plugin#20914

Merged
alexander-akait merged 7 commits into
mainfrom
claude/add-css-loader-tests-2jl6G
May 5, 2026
Merged

test: add missing CSS test cases inspired by css-loader and mini-css-extract-plugin#20914
alexander-akait merged 7 commits into
mainfrom
claude/add-css-loader-tests-2jl6G

Conversation

@alexander-akait
Copy link
Copy Markdown
Member

Add the following missing test cases under test/configCases/css/:

css-loader:

  • empty.module.css: ensure importing an empty CSS module works (issue-1033 in css-loader)
  • component-name.module.css: cover PascalCase / mixed-case / UPPER class names
  • composes-chain.module.css: verify composes resolution across more than two levels

mini-css-extract-plugin:

  • local-at-import-with-media.css and friends: cover local @import combined
    with media query, supports() and chained imports

claude added 5 commits May 4, 2026 17:14
…extract-plugin

Add the following missing test cases under test/configCases/css/:

css-loader:
- empty.module.css: ensure importing an empty CSS module works (issue-1033 in css-loader)
- component-name.module.css: cover PascalCase / mixed-case / UPPER class names
- composes-chain.module.css: verify composes resolution across more than two levels

mini-css-extract-plugin:
- local-at-import-with-media.css and friends: cover local @import combined
  with media query, supports() and chained imports
…xtract-plugin

Port additional regression / edge-case fixtures that exist in
webpack-contrib/css-loader and webpack-contrib/mini-css-extract-plugin
but were not yet covered by webpack core's built-in CSS support.

css-loader:
- file.with.many.dots.in.name.module.css (issue-980): file name with
  multiple dots produces a valid local ident
- composes-duplicate.module.css: same imported class composed in
  multiple selectors of the same module
- keyframes-leak-scope.module.css: @Keyframes with default :local,
  :global(...), :local(...) and animation/animation-name interaction
- path-placeholder.module.css (issue-967): selectors with escaped
  filesystem-reserved chars

mini-css-extract-plugin:
- at-import-in-the-entry: external @import in an entry CSS that is
  imported after another entry CSS
- at-import-chain: deep chain of local @imports
- content-entries-with-same-import: two async chunks importing the
  same CSS files in different orders
Mini-css-extract-plugin's insert option is replaced in webpack core by
the createStylesheet compilation hook on CssLoadingRuntimeModule, which
lets a plugin patch the link element creation code. Add a test that
demonstrates this and verifies the customization reaches the runtime.

Also port two HMR cases from mini-css-extract-plugin that webpack core
did not yet exercise:

- imported-css-chain: HMR through @import a.css <- c.css <- index.css
  with a sibling b.css, mirrors mini-css-extract-plugin's hmr fixture
- composes: HMR for a CSS module that composes from a sibling module,
  asserting both the link sheet content and the composed locals stay
  consistent across the update
… ignoreWarnings

css-loader directory:
- localIdentHashSalt alone, localIdentHashDigest = "hex"/"base64",
  localIdentHashFunction = "md4" + "base64url", and a combined
  salt + sha256 + hex + custom length variant. These exercise the
  rename of css-loader's hashSalt option to localIdentHashSalt and
  cover digest variants the existing fixture didn't reach.
- at-value-extra.module.css: missing @value scenarios that aren't in
  css-modules/at-rule-value.module.css — @value composing imported
  values, @value inside func() positions, @value imported from a
  node_modules package (raw and via tilde alias), and a multi-step
  identifier chain.

ignore-conflicting-order:
- Same CSS chunk-merge that conflicting-order produces a warning
  for, but with ignoreWarnings: [/Conflicting order/] in the config.
  Verifies the warning is suppressed (no warnings.js fixture to
  match against).
…ests

Lets the generator.exportsConvention function form return an array of
names so a single class is exported under every alias in the array,
mirroring css-loader's exportLocalsConvention function behaviour.
Single-string returns continue to work unchanged.

Tests:
- exports-convention-function-array: function returning [name, name.toUpperCase()]
  exports both lower- and upper-case keys for the same class
- createStylesheet-attributes: covers mini-css-extract-plugin's `attributes`
  and `linkType` plugin options by tapping CssLoadingRuntimeModule's
  createStylesheet hook to set id/data-* attributes and link.type
- sync-class-names-between-targets: uses [file]__[local] localIdentName
  so web and node compilations produce identical class names with no
  getJSON-style cross-target sync needed
- hotCases/css/hmr-extra-links: ports the unrelated-link scenarios from
  mini-css-extract-plugin's HMR.test.js (data:, # anchor, link without
  href, external stylesheet) so CSS HMR is shown to leave them alone
  across multiple sequential updates
Copilot AI review requested due to automatic review settings May 5, 2026 15:30
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented May 5, 2026

CLA Not Signed

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 5, 2026

🦋 Changeset detected

Latest commit: 609bd46

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
webpack Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

This PR is packaged and the instant preview is available (959e210).

Install it locally:

  • npm
npm i -D webpack@https://pkg.pr.new/webpack@959e210
  • yarn
yarn add -D webpack@https://pkg.pr.new/webpack@959e210
  • pnpm
pnpm add -D webpack@https://pkg.pr.new/webpack@959e210

@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

❌ Patch coverage is 60.00000% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.34%. Comparing base (3374804) to head (609bd46).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
lib/util/conventions.js 60.00% 8 Missing ⚠️

❌ Your patch status has failed because the patch coverage (60.00%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.
❌ Your changes status has failed because you have indirect coverage changes. Learn more about Unexpected Coverage Changes and reasons for indirect coverage changes.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #20914      +/-   ##
==========================================
- Coverage   91.35%   91.34%   -0.01%     
==========================================
  Files         562      563       +1     
  Lines       55736    55874     +138     
  Branches    14764    14815      +51     
==========================================
+ Hits        50916    51039     +123     
- Misses       4820     4835      +15     
Flag Coverage Δ
integration 90.30% <60.00%> (-0.01%) ⬇️
test262 45.82% <5.00%> (-0.16%) ⬇️
unit 36.13% <5.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands webpack’s CSS-related test coverage across configCases and hotCases, and introduces a small enhancement to CSS Modules name exporting by allowing generator.exportsConvention (function form) to return multiple export names for a single local.

Changes:

  • Add new CSS test cases covering additional CSS Modules behaviors (empty modules, mixed-case class names, deep composes chains, hashing options, etc.).
  • Add new CSS runtime/HMR test cases to validate update behavior and link handling in the browser environment.
  • Extend CSS Modules generator.exportsConvention function form to accept string[] (multiple aliases), update typings, and add a changeset + dedicated test coverage.

Reviewed changes

Copilot reviewed 84 out of 86 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
types.d.ts Update generated typings to allow exportsConvention function to return string[].
test/hotCases/css/imported-css-chain/webpack.config.js Add hot-case webpack config for chained @import HMR scenario.
test/hotCases/css/imported-css-chain/test.filter.js Restrict hot-case execution to target === "web".
test/hotCases/css/imported-css-chain/test.config.js Configure jsdom environment for the hot-case.
test/hotCases/css/imported-css-chain/index.js Add HMR test validating chained @import updates.
test/hotCases/css/imported-css-chain/index.css CSS fixture with HMR update sections for chained imports.
test/hotCases/css/imported-css-chain/c.css CSS import chain fixture (imports a.css).
test/hotCases/css/imported-css-chain/b.css CSS fixture used by chained import case.
test/hotCases/css/imported-css-chain/a.css CSS fixture with HMR update sections for background changes.
test/hotCases/css/hmr-extra-links/webpack.config.js Add hot-case webpack config for link-preservation scenario.
test/hotCases/css/hmr-extra-links/test.filter.js Restrict hot-case execution to target === "web".
test/hotCases/css/hmr-extra-links/test.config.js Configure jsdom environment for the hot-case.
test/hotCases/css/hmr-extra-links/index.js Add HMR test ensuring CSS HMR doesn’t touch unrelated <link> tags.
test/hotCases/css/hmr-extra-links/index.css CSS fixture with multiple HMR updates.
test/hotCases/css/composes/webpack.config.js Add hot-case webpack config for CSS Modules composes HMR scenario.
test/hotCases/css/composes/test.filter.js Restrict hot-case execution to target === "web".
test/hotCases/css/composes/test.config.js Configure jsdom environment for the hot-case.
test/hotCases/css/composes/style.module.css CSS Modules fixture using composes, with HMR update sections.
test/hotCases/css/composes/shared.module.css Shared composed CSS Modules fixture.
test/hotCases/css/composes/index.js Add HMR test validating CSS Modules composes behavior across updates.
test/configCases/css/sync-class-names-between-targets/webpack.config.js Add multi-target (web/node) config to verify deterministic classnames via [file].
test/configCases/css/sync-class-names-between-targets/style.module.css CSS Modules fixture including composed + mixed naming styles.
test/configCases/css/sync-class-names-between-targets/index.js Assertion that web/node produce identical exported classnames.
test/configCases/css/mini-css-extract-plugin/test.config.js Extend expected bundle list for additional mini-css-extract-plugin-inspired cases.
test/configCases/css/mini-css-extract-plugin/local-at-import-with-media.css Add local @import fixture with media + supports conditions.
test/configCases/css/mini-css-extract-plugin/local-at-import-supports.css Supports-condition import target fixture.
test/configCases/css/mini-css-extract-plugin/local-at-import-media-screen.css Screen media import target fixture.
test/configCases/css/mini-css-extract-plugin/local-at-import-media-print.css Print media import target fixture.
test/configCases/css/mini-css-extract-plugin/index.js Add new mini-css-extract-plugin-inspired runtime tests + snapshots.
test/configCases/css/mini-css-extract-plugin/content-entries-two.js Add async chunk entry importing shared CSS in a different order (two).
test/configCases/css/mini-css-extract-plugin/content-entries-style2.css Shared CSS fixture (style2).
test/configCases/css/mini-css-extract-plugin/content-entries-style1.css Shared CSS fixture (style1).
test/configCases/css/mini-css-extract-plugin/content-entries-one.js Add async chunk entry importing shared CSS in a different order (one).
test/configCases/css/mini-css-extract-plugin/at-import-in-the-entry.js JS entry that imports CSS files to test @import behavior at entry.
test/configCases/css/mini-css-extract-plugin/at-import-in-the-entry-b.css CSS fixture containing an external @import url(...).
test/configCases/css/mini-css-extract-plugin/at-import-in-the-entry-a.css CSS fixture for entry import case.
test/configCases/css/mini-css-extract-plugin/at-import-chain.js JS entry for deep chained local @import test.
test/configCases/css/mini-css-extract-plugin/at-import-chain-bb.css Deep chained import fixture (bb).
test/configCases/css/mini-css-extract-plugin/at-import-chain-ba.css Deep chained import fixture (ba).
test/configCases/css/mini-css-extract-plugin/at-import-chain-b.css Chained import fixture (b) that imports ba/bb.
test/configCases/css/mini-css-extract-plugin/at-import-chain-ae.css Deep chained import fixture (ae).
test/configCases/css/mini-css-extract-plugin/at-import-chain-ad.css Deep chained import fixture (ad).
test/configCases/css/mini-css-extract-plugin/at-import-chain-ac.css Deep chained import fixture (ac).
test/configCases/css/mini-css-extract-plugin/at-import-chain-ab.css Deep chained import fixture (ab).
test/configCases/css/mini-css-extract-plugin/at-import-chain-aa.css Deep chained import fixture (aa).
test/configCases/css/mini-css-extract-plugin/at-import-chain-a.css Chained import fixture (a) that imports aa–ae.
test/configCases/css/mini-css-extract-plugin/snapshots/ConfigTest.snap Add snapshots for new mini-css-extract-plugin cases.
test/configCases/css/mini-css-extract-plugin/snapshots/ConfigCacheTest.snap Add cache snapshots for new mini-css-extract-plugin cases.
test/configCases/css/insert-plugin/webpack.config.js Add config case validating createStylesheet hook customization.
test/configCases/css/insert-plugin/test.config.js Configure expected bundle outputs for insert-plugin test case.
test/configCases/css/insert-plugin/style.css CSS fixture for insert-plugin test.
test/configCases/css/insert-plugin/index.js Runtime assertion that createStylesheet hook modified the link element.
test/configCases/css/ignore-conflicting-order/webpack.config.js Add config case ensuring ignoreWarnings can silence CSS conflicting-order warnings.
test/configCases/css/ignore-conflicting-order/test.config.js Configure expected bundle outputs for ignore-conflicting-order case.
test/configCases/css/ignore-conflicting-order/lazy2.css CSS fixture generating conflicting order (variant 2).
test/configCases/css/ignore-conflicting-order/lazy1.css CSS fixture generating conflicting order (variant 1).
test/configCases/css/ignore-conflicting-order/index.js Trigger compilation/runtime by importing both conflicting-order CSS entries.
test/configCases/css/ignore-conflicting-order/c.css Conflicting-order shared import fixture (c).
test/configCases/css/ignore-conflicting-order/b.css Conflicting-order shared import fixture (b).
test/configCases/css/ignore-conflicting-order/a.css Conflicting-order shared import fixture (a).
test/configCases/css/exports-convention-function-array/webpack.config.js Add config case enabling exportsConvention function returning string[].
test/configCases/css/exports-convention-function-array/style.module.css CSS Modules fixture with representative class names for alias exporting.
test/configCases/css/exports-convention-function-array/index.js Assert both original and uppercase aliases export to the same local ident.
test/configCases/css/exports-convention-function-array/snapshots/ConfigTest.snap Snapshot for exportsConvention array behavior (non-cache).
test/configCases/css/exports-convention-function-array/snapshots/ConfigCacheTest.snap Snapshot for exportsConvention array behavior (cache).
test/configCases/css/css-loader/webpack.config.js Extend css-loader-aligned config cases with additional local ident hash options.
test/configCases/css/css-loader/path-placeholder.module.css Add fixture covering special-character/path-like local names.
test/configCases/css/css-loader/keyframes-leak-scope.module.css Add fixture covering keyframes scoping/leak scenarios.
test/configCases/css/css-loader/index.js Import and snapshot additional css-loader-aligned fixtures.
test/configCases/css/css-loader/imported-simple.module.css Add fixture used for composes duplication tests.
test/configCases/css/css-loader/file.with.many.dots.in.name.module.css Add fixture covering filenames with many dots.
test/configCases/css/css-loader/empty.module.css Add empty CSS module fixture.
test/configCases/css/css-loader/composes-duplicate.module.css Add fixture covering multiple composes from same source.
test/configCases/css/css-loader/composes-chain.module.css Add fixture covering multi-level composes chains.
test/configCases/css/css-loader/component-name.module.css Add fixture covering PascalCase/mixed-case/UPPER class names.
test/configCases/css/css-loader/colors.module.css Add fixture supporting additional @value import tests.
test/configCases/css/css-loader/at-value-extra.module.css Add fixture covering additional @value patterns and imports.
test/configCases/css/css-loader/snapshots/ConfigTest.snap Update snapshots for expanded css-loader-aligned cases.
test/configCases/css/css-loader/snapshots/ConfigCacheTest.snap Update cache snapshots for expanded css-loader-aligned cases.
test/configCases/css/createStylesheet-attributes/webpack.config.js Add config case mirroring mini-css-extract-plugin link attribute behavior via hook.
test/configCases/css/createStylesheet-attributes/test.config.js Configure expected bundle outputs for createStylesheet-attributes case.
test/configCases/css/createStylesheet-attributes/style.css CSS fixture for createStylesheet-attributes case.
test/configCases/css/createStylesheet-attributes/index.js Runtime assertions for link attributes/type set by createStylesheet hook.
lib/util/conventions.js Enhance cssExportConvention to accept array returns from function conventions.
lib/dependencies/CssIcssExportDependency.js Update ExportsConventionFn typedef to allow string[] return type.
.changeset/css-exports-convention-array.md Add changeset documenting the minor feature for exportsConvention arrays.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +104 to +110
it("should work with local `@import` with media query, supports and layer", async () => {
await import("./local-at-import-with-media.css");

const links = [...document.getElementsByTagName("link")];

expect(links.find((item) => /local-at-import-with-media/.test(item.href)).sheet.css).toMatchSnapshot();
});
Comment on lines +1 to +5
---
"webpack": minor
---

The `generator.exportsConvention` function form for CSS modules now accepts `string[]` in addition to `string`. Returning an array exports the local under every name in the array, matching `css-loader`'s behaviour and letting consumers expose multiple aliases (e.g. `[name, name.toUpperCase()]`) for a single class.
Comment thread lib/util/conventions.js
Comment on lines 92 to +100
if (typeof convention === "function") {
set.add(convention(input));
const result = convention(input);
if (Array.isArray(result)) {
for (const name of result) {
set.add(name);
}
} else {
set.add(result);
}
Comment on lines +3 to +15
const findOurLink = () =>
[...window.document.getElementsByTagName("link")].find(
(link) =>
link.rel === "stylesheet" &&
link.href &&
link.href.includes("bundle.css")
);

it("should not touch non-stylesheet, data:, anchor or external links during CSS HMR", (done) => {
const head = window.document.head;

expect(findOurLink().sheet.css).toContain("color: red;");

- mini-css-extract-plugin/local-at-import-with-media.css: add an
  @import "..." layer(layer-name) entry so the test name (which
  mentions "layer") now reflects the fixture coverage
- lib/util/conventions.js: validate that exportsConvention function
  results are non-empty strings (or non-empty arrays of non-empty
  strings) and throw a clear error otherwise, so misconfigured
  conventions surface at compile time instead of crashing later
- test/hotCases/css/hmr-extra-links: assert findOurLink() returns a
  link before dereferencing .sheet.css so a missing match fails with
  a readable expectation instead of "Cannot read properties of
  undefined"
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 5, 2026

Merging this PR will degrade performance by 87.93%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 6 improved benchmarks
❌ 2 regressed benchmarks
✅ 136 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory benchmark "asset-modules-source", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 368.3 KB 160.4 KB ×2.3
Memory benchmark "concatenate-modules", scenario '{"name":"mode-development","mode":"development"}' 752 KB 558.4 KB +34.68%
Memory benchmark "asset-modules-source", scenario '{"name":"mode-development","mode":"development"}' 569.9 KB 4,720 KB -87.93%
Memory benchmark "many-modules-commonjs", scenario '{"name":"mode-development","mode":"development"}' 833.7 KB 1,142.7 KB -27.04%
Memory benchmark "concatenate-modules", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 298.6 KB 182.9 KB +63.28%
Memory benchmark "devtool-eval", scenario '{"name":"mode-development","mode":"development"}' 844 KB 608.1 KB +38.78%
Memory benchmark "devtool-eval-source-map", scenario '{"name":"mode-development","mode":"development"}' 1,587.6 KB 1,018.6 KB +55.86%
Memory benchmark "react", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 238.6 KB 170.9 KB +39.63%

Comparing claude/add-css-loader-tests-2jl6G (609bd46) with main (b34c597)

Open in CodSpeed

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 85 out of 87 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/util/conventions.js
Comment on lines +93 to +99
const result = convention(input);
const validate = (name) => {
if (typeof name !== "string" || name.length === 0) {
throw new Error(
`exportsConvention function must return a non-empty string or an array of non-empty strings, got ${JSON.stringify(result)}`
);
}
- Fix tsc error: add a string type annotation on the validate
  callback parameter so noImplicitAny is satisfied.
- Address Copilot review: JSON.stringify can throw for BigInt /
  circular values, masking the intended validation error. Wrap it in
  a safeStringify helper that falls back to String(...) and finally
  to a placeholder, so an invalid exportsConvention return type
  always surfaces the webpack error rather than a TypeError.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Types Coverage

Coverage after merging claude/add-css-loader-tests-2jl6G into main will be
98.92%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
bin
   webpack.js98.77%100%100%98.77%91
examples
   build-common.js100%100%100%100%
   buildAll.js100%100%100%100%
   examples.js100%100%100%100%
   template-common.js98.21%100%100%98.21%72
examples/custom-javascript-parser
   test.filter.js100%100%100%100%
examples/custom-javascript-parser/internals
   acorn-parse.js100%100%100%100%
   meriyah-parse.js100%100%100%100%
   oxc-parse.js91.30%100%100%91.30%140, 142–143, 145, 147, 153–154, 161, 168, 90
examples/markdown
   webpack.config.mjs100%100%100%100%
examples/typescript
   test.filter.js50%100%100%50%5
examples/virtual-modules
   test.filter.js100%100%100%100%
examples/wasm-bindgen-esm
   test.filter.js100%100%100%100%
examples/wasm-complex
   test.filter.js100%100%100%100%
examples/wasm-simple
   test.filter.js100%100%100%100%
examples/wasm-simple-source-phase
   test.filter.js100%100%100%100%
lib
   APIPlugin.js100%100%100%100%
   AsyncDependenciesBlock.js100%100%100%100%
   AutomaticPrefetchPlugin.js100%100%100%100%
   BannerPlugin.js100%100%100%100%
   Cache.js98.21%100%100%98.21%101
   CacheFacade.js100%100%100%100%
   Chunk.js99.72%100%100%99.72%37
   ChunkGraph.js100%100%100%100%
   ChunkGroup.js100%100%100%100%
   ChunkTemplate.js100%100%100%100%
   CleanPlugin.js98.72%100%100%98.72%206, 226, 382
   CodeGenerationResults.js100%100%100%100%
   CompatibilityPlugin.js100%100%100%100%
   Compilation.js98.55%100%100%98.55%1554, 1850, 1857, 1865, 1887, 2783, 3208, 3870, 3899, 3952–3953, 3957, 3962, 3978–3979, 3993–3994, 3999–4000, 4477, 4503, 493, 498, 5211, 5292, 5307, 5332–5333, 5335, 5659, 5664, 5670, 5673, 5685, 5687, 5691, 5707, 5722, 5754, 5808, 5832, 5946, 712–713
   Compiler.js99.55%100%100%99.55%1116–1117, 1125
   ConcatenationScope.js98.59%100%100%98.59%189
   ConditionalInitFragment.js100%100%100%100%
   ConstPlugin.js100%100%100%100%
   ContextExclusionPlugin.js100%100%100%100%
   ContextModule.js100%100%100%100%
   ContextModuleFactory.js97.75%100%100%97.75%258, 393, 418, 443, 447, 458
   ContextReplacementPlugin.js100%100%100%100%
   DefinePlugin.js98.92%100%100%98.92%158–159, 175, 194, 268
   DependenciesBlock.js100%100%100%100%
   Dependency.js98.20%100%100%98.20%379, 425
   DependencyTemplate.js100%100%100%100%
   DependencyTemplates.js100%100%100%100%
   DotenvPlugin.js97.88%100%100%97.88%237, 378, 391–392
   DynamicEntryPlugin.js100%100%100%100%
   EntryOptionPlugin.js100%100%100%100%
   EntryPlugin.js100%100%100%100%
   Entrypoint.js100%100%100%100%
   EnvironmentPlugin.js97.14%100%100%97.14%49
   ErrorHelpers.js100%100%100%100%
   EvalDevToolModulePlugin.js100%100%100%100%
   EvalSourceMapDevToolPlugin.js100%100%100%100%
   ExportsInfo.js100%100%100%100%
   ExportsInfoApiPlugin.js100%100%100%100%
   ExternalModule.js98.89%100%100%98.89%399–403, 542
   ExternalModuleFactoryPlugin.js100%100%100%100%
   ExternalsPlugin.js100%100%100%100%
   FileSystemInfo.js99.49%100%100%99.49%182, 2213–2214, 2217, 2228, 2239, 2250, 278, 3596, 3611, 3635
   FlagAllModulesAsUsedPlugin.js100%100%100%100%
   FlagDependencyExportsPlugin.js98.74%100%100%98.74%399, 401, 405
   FlagDependencyUsagePlugin.js100%100%100%100%
   FlagEntryExportAsUsedPlugin.js100%100%100%100%
   Generator.js100%100%100%100%
   HotModuleReplacementPlugin.js100%100%100%100%
   HotUpdateChunk.js100%100%100%100%
   IgnorePlugin.js100%100%100%100%
   IgnoreWarningsPlugin.js100%100%100%100%
   InitFragment.js100%100%100%100%
   JavascriptMetaInfoPlugin.js100%100%100%100%
   LibraryTemplatePlugin.js100%100%100%100%
   LoaderOptionsPlugin.js100%100%100%100%
   LoaderTargetPlugin.js100%100%100%100%
   MainTemplate.js100%100%100%100%
   ManifestPlugin.js100%100%100%100%
   Module.js98.50%100%100%98.50%1304, 1309, 1370, 1384, 1446, 1455
   ModuleFactory.js100%100%100%100%
   ModuleFilenameHelpers.js98.85%100%100%98.85%106, 108
   ModuleGraph.js99.73%100%100%99.73%1004
   ModuleGraphConnection.js100%100%100%100%
   ModuleInfoHeaderPlugin.js100%100%100%100%
   ModuleProfile.js100%100%100%100%
   ModuleSourceTypeConstants.js100%100%100%100%
   ModuleTemplate.js100%100%100%100%
   ModuleTypeConstants.js100%100%100%100%
   MultiCompiler.js99.69%100%100%99.69%645
   MultiStats.js100%100%100%100%
   MultiWatching.js100%100%100%100%
   NoEmitOnErrorsPlugin.js100%100%100%100%
   NodeStuffPlugin.js100%100%100%100%
   NormalModule.js97.78%100%100%97.78%1020, 1036, 1123, 1774, 1779–1789, 708, 711, 728, 745, 986
   NormalModuleFactory.js99.47%100%100%99.47%1067, 1376, 466, 478
   NormalModuleReplacementPlugin.js100%100%100%100%
   NullFactory.js100%100%100%100%
   OptimizationStages.js100%100%100%100%
   OptionsApply.js100%100%100%100%
   Parser.js100%100%100%100%
   PlatformPlugin.js100%100%100%100%
   PrefetchPlugin.js100%100%100%100%
   ProgressPlugin.js98.75%100%100%98.75%446–447, 452, 454, 518
   ProvidePlugin.js100%100%100%100%
   RawModule.js100%100%100%100%
   RecordIdsPlugin.js100%100%100%100%
   RequestShortener.js100%100%100%100%
   ResolverFactory.js100%100%100%100%
   RuntimeGlobals.js100%100%100%100%
   RuntimeModule.js100%100%100%100%
   RuntimePlugin.js100%100%100%100%
   RuntimeTemplate.js100%100%100%100%
   SelfModuleFactory.js100%100%100%100%
   SingleEntryPlugin.js100%100%100%100%
   SourceMapDevToolModuleOptionsPlugin.js100%100%100%100%
   SourceMapDevToolPlugin.js99.16%100%100%99.16%267–268, 610
   Stats.js100%100%100%100%
   Template.js100%100%100%100%
   TemplatedPathPlugin.js98.86%100%100%98.86%134–135
   UseStrictPlugin.js100%100%100%100%
   WarnCaseSensitiveModulesPlugin.js100%100%100%100%
   WarnDeprecatedOptionPlugin.js100%100%100%100%
   WarnNoModeSetPlugin.js100%100%100%100%
   WatchIgnorePlugin.js100%100%100%100%
   Watching.js100%100%100%100%
   WebpackError.js100%100%100%100%
   WebpackIsIncludedPlugin.js100%100%100%100%
   WebpackOptionsApply.js100%100%100%100%
   WebpackOptionsDefaulter.js100%100%100%100%
   buildChunkGraph.js99.87%100%100%99.87%325
   cli.js98.71%100%100%98.71%117, 469, 501, 543, 813
   index.js100%100%100%100%
   validateSchema.js94.67%100%100%94.67%100, 87, 89, 98
   webpack.js97.22%100%100%97.22%196, 218, 220
lib/asset
   AssetBytesGenerator.js100%100%100%100%
   AssetBytesParser.js100%100%100%100%
   AssetGenerator.js100%100%100%100%
   AssetModulesPlugin.js97.77%100%100%97.77%285, 309, 312, 364, 40
   AssetParser.js100%100%100%100%
   AssetSourceGenerator.js100%100%100%100%
   AssetSourceParser.js100%100%100%100%
   RawDataUrlModule.js100%100%100%100%
lib/async-modules
   AsyncModuleHelpers.js100%100%100%100%
   AwaitDependenciesInitFragment.js100%100%100%100%
   InferAsyncModulesPlugin.js100%100%100%100%
lib/cache
   AddBuildDependenciesPlugin.js100%100%100%100%
   AddManagedPathsPlugin.js100%100%100%100%
   IdleFileCachePlugin.js97.92%100%100%97.92%71, 83, 91
   MemoryCachePlugin.js95.83%100%100%95.83%33
   MemoryWithGcCachePlugin.js93.15%100%100%93.15%106, 113–114, 122, 89
   PackFileCacheStrategy.js96.40%100%100%96.40%1250, 1350, 1354, 1416, 628, 647, 657–659, 661, 677–678, 683, 686, 688, 693, 698, 722, 728, 762, 768, 774, 779, 790, 799, 804–805, 807, 824, 830–831, 833
   ResolverCachePlugin.js100%100%100%100%
   getLazyHashedEtag.js100%100%100%100%
   mergeEtags.js100%100%100%100%
lib/config
   browserslistTargetHandler.js100%100%100%100%
   defaults.js99.13%100%100%99.13%1297–1299, 1307, 270, 273, 278, 282, 468
   normalization.js99%100%100%99%191–192, 258, 273
   target.js100%100%100%100%
lib/container
   ContainerEntryDependency.js100%100%100%100%
   ContainerEntryModule.js100%100%100%100%
   ContainerEntryModuleFactory.js100%100%100%100%
   ContainerExposedDependency.js100%100%100%100%
   ContainerPlugin.js100%100%100%100%
   ContainerReferencePlugin.js100%100%100%100%
   FallbackDependency.js100%100%100%100%
   FallbackItemDependency.js100%100%100%100%
   FallbackModule.js100%100%100%100%
   FallbackModuleFactory.js100%100%100%100%
   HoistContainerReferencesPlugin.js100%100%100%100%
   ModuleFederationPlugin.js100%100%100%100%
   RemoteModule.js100%100%100%100%
   RemoteRuntimeModule.js100%100%100%100%
   

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 85 out of 87 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +5
---
"webpack": minor
---

The `generator.exportsConvention` function form for CSS modules now accepts `string[]` in addition to `string`. Returning an array exports the local under every name in the array, matching `css-loader`'s behaviour and letting consumers expose multiple aliases (e.g. `[name, name.toUpperCase()]`) for a single class.
@alexander-akait alexander-akait merged commit 959e210 into main May 5, 2026
61 of 65 checks passed
@alexander-akait alexander-akait deleted the claude/add-css-loader-tests-2jl6G branch May 5, 2026 17:57
aryanraj45 pushed a commit to aryanraj45/webpack that referenced this pull request May 8, 2026
bjohansebas added a commit to webpack/webpack.js.org that referenced this pull request May 17, 2026
Webpack 5.107 lets the generator.exportsConvention function for CSS
modules return either a string or a string[]. Returning an array
exports the local class under every name in the array, matching
css-loader's behavior. Updates the type comments in the module.generator
example and adds a dedicated subsection with a worked example.

Refs: webpack/webpack#20914
alexander-akait pushed a commit to webpack/webpack.js.org that referenced this pull request May 18, 2026
…8240)

Webpack 5.107 lets the generator.exportsConvention function for CSS
modules return either a string or a string[]. Returning an array
exports the local class under every name in the array, matching
css-loader's behavior. Updates the type comments in the module.generator
example and adds a dedicated subsection with a worked example.

Refs: webpack/webpack#20914
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants