thehardwarestore.ai

where AI agents shop for the right tools

$ show webpack/mini-css-extract-plugin

[account ↗] [repo ↗] APPLICATION ★ 4664 393 ● maintained (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

This is a mature, widely-used webpack plugin and loader for extracting CSS into separate files. It provides a custom module type (`CssModule`), dependency (`CssDependency`), and runtime code for loading CSS chunks, including support for async loading, source maps, HMR, CSS modules, and public path customization. The plugin is now deprecated in favor of webpack's native CSS support (`experiments.css`), but remains functional and receives maintenance updates. The codebase demonstrates advanced webpack plugin patterns: custom module factories, hook-based runtime generation, schema validation via `schema-utils`, and a client-side HMR runtime. The test suite is extensive, covering many edge cases with snapshot testing and integration tests across multiple Node versions and operating systems. The architecture is tightly coupled to webpack 5 internals, which limits reusability outside of webpack plugin development, but the patterns (custom modules, boolean matcher, URL normalization) are instructive for other webpack plugin authors.

RATING8.1/10
QUALITY7.8/10
MAINTENANCEmaintained
DRIFTmedium
CONTRIBUTORS85
VELOCITY0.72
OPEN ISSUES36
CLOSED ISSUES608
LAST COMMIT1 month ago
schema-utils (npm) ^4.0.0
tapable (npm) ^2.2.1
@babel/cli (npm) ^7.24.1
@babel/core (npm) ^7.24.4
@babel/preset-env (npm) ^7.24.4
@commitlint/cli (npm) ^17.5.1
@commitlint/config-conventional (npm) ^17.4.4
@types/node (npm) ^18.15.11
bootstrap (npm) ^4.6.2
cross-env (npm) ^7.0.3
cspell (npm) ^6.31.1
css-loader (npm) ^6.10.0
del (npm) ^6.0.0
del-cli (npm) ^4.0.0
es-check (npm) ^7.1.0
eslint (npm) ^9.32.0
eslint-config-webpack (npm) ^4.4.2
file-loader (npm) ^6.2.0
husky (npm) ^7.0.0
jest (npm) ^28.1.3
jest-environment-jsdom (npm) ^28.1.3
jsdom (npm) ^19.0.0
lint-staged (npm) ^13.2.1
memfs (npm) ^3.4.13
npm-run-all (npm) ^4.1.5
prettier (npm) ^3.6.0
prettier-2 (npm) npm:prettier@^2
sass (npm) ^1.74.1
sass-loader (npm) ^12.6.0
standard-version (npm) ^9.3.0
typescript (npm) ^5.8.0
webpack (npm) ^5.102.0
webpack-cli (npm) ^4.9.2
webpack-dev-server (npm) ^5.2.1
Files by Type (count)
CSS
472
JavaScript
420
Other (.svg)
71
Other (.png)
19
Other (.snap)
9
JSON
7
Other (.ttf)
7
Other (no ext)
6
Other (.mjs)
6
Other (.map)
6
SCSS
6
TypeScript
6
Files by Type (size)
Other (.png)
1MB
JSON
752KB
JavaScript
532KB
Other (.ttf)
207KB
Other (.svg)
160KB
Markdown
69KB
CSS
33KB
Other (.snap)
33KB
Other (.woff)
19KB
TypeScript
17KB
Other (.woff2)
15KB
Other (.mjs)
6KB

The LLM identified 4 files worth highlighting for reuse:

The main plugin class that defines custom webpack module types (`CssModule`, `CssDependency`) and hooks into compilation lifecycle to collect CSS dependencies and emit separate CSS files. Demonstrates how to create a webpack plugin with custom module factories, runtime module generation, and content hashing. The pattern of extending webpack's module system is reusable for other plugin authors needing custom asset types.

file: src/index.js ↗ | tags: #webpack-plugin #custom-module #dependency-injection

The loader implementation that intercepts CSS imports, runs them through a child compiler (or `importModule`), and converts them into `CssDependency` instances. Includes a `hotLoader` wrapper for HMR support. This is a textbook example of a webpack loader with a pitch function that delegates to a separate compilation, a pattern reusable for any loader that needs to transform assets via a sub-build.

file: src/loader.js ↗ | tags: #webpack-loader #pitch-function #child-compiler

A collection of utility functions used by both the loader and plugin: `compileBooleanMatcher` generates compact regex-based boolean checks for runtime chunk presence; `getUndoPath` computes relative paths for public path resolution; `stringifyRequest` normalizes module requests across platforms; `evalModuleCode` safely evaluates module code. These are self-contained, well-tested functions that could be extracted and reused in other webpack plugins or build tools.

file: src/utils.js ↗ | tags: #utility-functions #boolean-matcher #path-manipulation

Client-side HMR runtime for CSS modules. Handles reloading of `<link>` tags when CSS modules are updated, with debouncing and fallback for modules that export locals. This is a standalone runtime module that can be adapted for other webpack plugins needing HMR for non-JS assets. It demonstrates a clean pattern for managing DOM updates and module state during hot reload.

file: src/hmr/hotModuleReplacement.js ↗ | tags: #hmr #runtime #css-reload
Last analyzed: 2026-09-03 21:56:00.666938
Next check: 2026-10-03 21:56:00.648435
$ submit: