The css-loader interprets @import and url() like import/require() and resolves them.
Warning
To use the latest version of css-loader, webpack@5 is required
To begin, you'll need to install css-loader:
npm install --save-dev css-loaderor
yarn add -D css-loaderor
pnpm add -D css-loaderIn the example configuration below, style-loader is used to inject the processed CSS into the DOM during runtime. You may need to install it as well:
npm install --save-dev style-loaderThen, add the loader to your webpack configuration. For example:
file.js
import * as css from "file.css";webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
},
],
},
};Finally, run webpack using the method you normally use (e.g., via CLI or an npm script).
If you need to extract CSS into a separate file (i.e. do not store CSS in a JS module), consider using the recommend example.
Type:
type url =
| boolean
| {
filter: (url: string, resourcePath: string) => boolean;
};Default: true
Enables or disables handling the CSS functions url and image-set.
- If set to
false,css-loaderwill not parse any paths specified inurlorimage-set. - You can also pass a function to control this behavior dynamically based on the asset path.
As of version 4.0.0, absolute paths are resolved based on the server root.
Examples resolutions:
url(image.png) => require('./image.png')
url('image.png') => require('./image.png')
url(./image.png) => require('./image.png')
url('./image.png') => require('./image.png')
url('http://dontwritehorriblecode.com/2112.png') => require('http://dontwritehorriblecode.com/2112.png')
image-set(url('image2x.png') 1x, url('image1x.png') 2x) => require('./image1x.png') and require('./image2x.png')To import assets from a node_modules path (including resolve.modules) or an alias, prefix it with a ~:
url(~module/image.png) => require('module/image.png')
url('~module/image.png') => require('module/image.png')
url(~aliasDirectory/image.png) => require('otherDirectory/image.png')Enable/disable url() resolving.
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
url: true,
},
},
],
},
};Allows filtering of url() values.
Any filtered url() will not be resolved (left in the code as they were written).
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
url: {
filter: (url, resourcePath) => {
// resourcePath - path to css file
// Don't handle `img.png` urls
if (url.includes("img.png")) {
return false;
}
// Don't handle images under root-relative /external_images/
if (/^\/external_images\//.test(url)) {
return false;
}
return true;
},
},
},
},
],
},
};Type:
type importFn =
| boolean
| {
filter: (
url: string,
media: string,
resourcePath: string,
supports?: string,
layer?: string,
) => boolean;
};Default: true
Allows you to enable or disable handling of @import at-rules.
Controls how @import statements are resolved.
Absolute URLs in @import will be moved in runtime code.
Examples resolutions:
@import 'style.css' => require('./style.css')
@import url(style.css) => require('./style.css')
@import url('style.css') => require('./style.css')
@import './style.css' => require('./style.css')
@import url(./style.css) => require('./style.css')
@import url('./style.css') => require('./style.css')
@import url('http://dontwritehorriblecode.com/style.css') => @import url('http://dontwritehorriblecode.com/style.css') in runtime
To import styles from a node_modules path (include resolve.modules) or an alias, prefix it with a ~:
@import url(~module/style.css) => require('module/style.css')
@import url('~module/style.css') => require('module/style.css')
@import url(~aliasDirectory/style.css) => require('otherDirectory/style.css')
Enable/disable @import resolving.
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
import: true,
},
},
],
},
};Type:
type filter = (url: string, media: string, resourcePath: string) => boolean;Default: undefined
Allows filtering of @import.
Any filtered @import will not be resolved (left in the code as they were written).
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
import: {
filter: (url, media, resourcePath) => {
// resourcePath - path to css file
// Don't handle `style.css` import
if (url.includes("style.css")) {
return false;
}
return true;
},
},
},
},
],
},
};Type:
type modules =
| boolean
| "local"
| "global"
| "pure"
| "icss"
| {
auto: boolean | regExp | ((resourcePath: string) => boolean);
mode:
| "local"
| "global"
| "pure"
| "icss"
| ((resourcePath) => "local" | "global" | "pure" | "icss");
localIdentName: string;
localIdentContext: string;
localIdentHashSalt: string;
localIdentHashFunction: string;
localIdentHashDigest: string;
localIdentRegExp: string | regExp;
getLocalIdent: (
context: LoaderContext,
localIdentName: string,
localName: string,
) => string;
namedExport: boolean;
exportGlobals: boolean;
exportLocalsConvention:
| "as-is"
| "camel-case"
| "camel-case-only"
| "dashes"
| "dashes-only"
| ((name: string) => string);
exportOnlyLocals: boolean;
getJSON: ({
resourcePath,
imports,
exports,
replacements,
}: {
resourcePath: string;
imports: object[];
exports: object[];
replacements: object[];
}) => Promise<void> | void;
};Default: undefined
Allows you to enable or disable CSS Modules or ICSS and configure them:
undefined: Enables CSS modules for all files matching/\.module\.\w+$/i.test(filename)or/\.icss\.\w+$/i.test(filename)regexp.true: Enables CSS modules for all files.false: Disables CSS Modules for all files.string: Disables CSS Modules for all files and set themodeoption (see mode for details).object: Enables CSS modules for all files unless themodules.autooption is provided. otherwise themodules.autooption will determine whether if it is CSS Modules or not (see auto for more details).
The modules option enables/disables the CSS Modules specification and configures its behavior.
Setting modules: false can improve performance because we avoid parsing CSS Modules features, this is useful for developers using use vanilla CSS or other technologies.
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
modules: true,
},
},
],
},
};- Using
localvalue requires you to specify:globalclasses. - Using
globalvalue requires you to specify:localclasses. - Using
purevalue requires selectors must contain at least one local class or ID.
You can find more information on scoping module here.
With CSS Modules, styles are scoped locally, preventing conflicts with global styles.
Use :local(.className) to declare a className in the local scope. The local identifiers are exported by the module.
- With
:local(without parentheses) local mode can be switchedonfor this selector. - The
:global(.className)notation can be used to declare an explicit global selector. - With
:global(without parentheses) global mode can be switchedonfor this selector.
The loader replaces local selectors with unique, scoped identifiers. The chosen unique identifiers are exported by the module.
:local(.className) {
background: red;
}
:local .className {
color: green;
}
:local(.className .subClass) {
color: green;
}
:local .className .subClass :global(.global-class-name) {
color: blue;
}Output (example):
._23_aKvs-b8bW2Vg3fwHozO {
background: red;
}
._23_aKvs-b8bW2Vg3fwHozO {
color: green;
}
._23_aKvs-b8bW2Vg3fwHozO ._13LGdX8RMStbBE9w-t0gZ1 {
color: green;
}
._23_aKvs-b8bW2Vg3fwHozO ._13LGdX8RMStbBE9w-t0gZ1 .global-class-name {
color: blue;
}Note
Identifiers are exported
exports.locals = {
className: "_23_aKvs-b8bW2Vg3fwHozO",
subClass: "_13LGdX8RMStbBE9w-t0gZ1",
};CamelCase naming is recommended for local selectors, as it simplifies usage in imported JS modules.
Although you can use :local(#someId), but this is not recommended. Prefer classes instead of IDs for modular styling.
When declaring a local class name, you can compose it from one or more other local class names.
:local(.className) {
background: red;
color: yellow;
}
:local(.subClass) {
composes: className;
background: blue;
}This does not alter the final CSS output, but the generated subClass will include both class names in its export.
exports.locals = {
className: "_23_aKvs-b8bW2Vg3fwHozO",
subClass: "_13LGdX8RMStbBE9w-t0gZ1 _23_aKvs-b8bW2Vg3fwHozO",
};._23_aKvs-b8bW2Vg3fwHozO {
background: red;
color: yellow;
}
._13LGdX8RMStbBE9w-t0gZ1 {
background: blue;
}To import a local class names from another module.
Note
It is highly recommended to include file extensions when importing a file, since it is possible to import a file with any extension and it is not known in advance which file to use.
:local(.continueButton) {
composes: button from "library/button.css";
background: red;
}:local(.nameEdit) {
composes: edit highlight from "./edit.css";
background: red;
}To import from multiple modules use multiple composes: rules.
:local(.className) {
composes:
edit highlight from "./edit.css",
button from "module/button.css",
classFromThisModule;
background: red;
}or
:local(.className) {
composes: edit highlight from "./edit.css";
composes: button from "module/button.css";
composes: classFromThisModule;
background: red;
}You can use @value to specific values to be reused throughout a document.
We recommend following a naming convention:
v-prefix for valuess-prefix for selectorsm-prefix for media at-rules.
@value v-primary: #BF4040;
@value s-black: black-selector;
@value m-large: (min-width: 960px);
.header {
color: v-primary;
padding: 0 10px;
}
.s-black {
color: black;
}
@media m-large {
.header {
padding: 0 20px;
}
}Enable CSS Modules features.
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
modules: true,
},
},
],
},
};Enable CSS Modules features and setup mode.
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
// Using `local` value has same effect like using `modules: true`
modules: "global",
},
},
],
},
};Enable CSS Modules features and configure its behavior through options.
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
modules: {
mode: "local",
auto: true,
exportGlobals: true,
localIdentName: "[path][name]__[local]--[hash:base64:5]",
localIdentContext: path.resolve(__dirname, "src"),
localIdentHashSalt: "my-custom-hash",
namedExport: true,
exportLocalsConvention: "as-is",
exportOnlyLocals: false,
getJSON: ({ resourcePath, imports, exports, replacements }) => {},
},
},
},
],
},
};Type:
type auto =
| boolean
| regExp
| ((
resourcePath: string,
resourceQuery: string,
resourceFragment: string,
) => boolean);Default: undefined
Allows auto enable CSS modules or ICSS based on the file name, query or fragment when modules option is an object.
Possible values:
undefined: Enables CSS modules for all files.true: Enables CSS modules for files matching/\.module\.\w+$/i.test(filename)and/\.icss\.\w+$/i.test(filename)regexp.false: Disables CSS Modules for all files.RegExp: Enables CSS modules for all files matching/RegExp/i.test(filename)regexp.function: Enables CSS Modules for files based on the file name satisfying your filter function check.
Possible values:
true: Enables CSS modules or Interoperable CSS (ICSS) format, sets themodules.modeoption tolocalvalue for all files which satisfy/\.module(s)?\.\w+$/i.test(filename)condition or sets themodules.modeoption toicssvalue for all files which satisfy/\.icss\.\w+$/i.test(filename)condition.false: Disables CSS modules or ICSS format based on filename for all files.
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
modules: {
auto: true,
},
},
},
],
},
};Enables CSS modules for files based on the filename satisfying your regex check.
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
modules: {
auto: /\.custom-module\.\w+$/i,
},
},
},
],
},
};Enables CSS Modules for files based on the filename, query or fragment satisfying your filter function check.
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
modules: {
auto: (resourcePath, resourceQuery, resourceFragment) => {
return resourcePath.endsWith(".custom-module.css");
},
},
},
},
],
},
};Type:
type mode =
| "local"
| "global"
| "pure"
| "icss"
| ((
resourcePath: string,
resourceQuery: string,
resourceFragment: string,
) => "local" | "global" | "pure" | "icss");Default: 'local'
Setup mode option. You can omit the value when you want local mode.
Controls the level of compilation applied to the input styles.
- The
local,global, andpurehandlesclassandidscoping and@valuevalues. - The
icsswill only compile the low levelInteroperable CSS (ICSS)format for declaring:importand:exportdependencies between CSS and other languages.
ICSS underpins CSS Module support, and provides a low level syntax for other tools to implement CSS-module variations of their own.
Possible values - local, global, pure, and icss.
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
modules: {
mode: "global",
},
},
},
],
},
};Allows setting different values for the mode option based on the filename, query or fragment.
Possible return values - local, global, pure and icss.
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
modules: {
// Callback must return "local", "global", or "pure" values
mode: (resourcePath, resourceQuery, resourceFragment) => {
if (/pure.css$/i.test(resourcePath)) {
return "pure";
}
if (/global.css$/i.test(resourcePath)) {
return "global";
}
return "local";
},
},
},
},
],
},
};Type:
type localIdentName = string;Default: '[hash:base64]'
Allows to configure the generated local ident name.
For more information on options see:
- webpack template strings,
- output.hashDigest,
- output.hashDigestLength,
- output.hashFunction,
- output.hashSalt.
Supported template strings:
[name]the basename of the resource[folder]the folder the resource relative to thecompiler.contextoption ormodules.localIdentContextoption.[path]the path of the resource relative to thecompiler.contextoption ormodules.localIdentContextoption.[file]- filename and path.[ext]- extension with leading..[hash]- the hash of the string, generated based onlocalIdentHashSalt,localIdentHashFunction,localIdentHashDigest,localIdentHashDigestLength,localIdentContext,resourcePathandexportName[<hashFunction>:hash:<hashDigest>:<hashDigestLength>]- hash with hash settings.[local]- original class.
Recommendations:
- Use
'[path][name]__[local]'for development - Use
'[hash:base64]'for production
The [local] placeholder contains original class.
Note: all reserved characters (<>:"/\|?*) and control filesystem characters (excluding characters in the [local] placeholder) will be converted to -.
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
modules: {
localIdentName: "[path][name]__[local]--[hash:base64:5]",
},
},
},
],
},
};Type:
type localIdentContex = string;Default: compiler.context
Allows redefining the basic loader context for local ident name.
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
modules: {
localIdentContext: path.resolve(__dirname, "src"),
},
},
},
],
},
};Type:
type localIdentHashSalt = string;Default: undefined
Allows to add custom hash to generate more unique classes.
For more information see output.hashSalt.
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
modules: {
localIdentHashSalt: "hash",
},
},
},
],
},
};Type:
type localIdentHashFunction = string;Default: md4
Allows to specify hash function to generate classes .
For more information see output.hashFunction.
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
modules: {
localIdentHashFunction: "md4",
},
},
},
],
},
};Type:
type localIdentHashDigest = string;Default: hex
Allows to specify hash digest to generate classes.
For more information see output.hashDigest.
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
modules: {
localIdentHashDigest: "base64",
},
},
},
],
},
};Type:
type localIdentHashDigestLength = number;Default: 20
Allows to specify hash digest length to generate classes.
For more information, see output.hashDigestLength.
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
modules: {
localIdentHashDigestLength: 5,
},
},
},
],
},
};Type: 'resource-path-and-local-name' | 'minimal-subset'
Default: 'resource-path-and-local-name'
Should local name be used when computing the hash.
'resource-path-and-local-name'Both resource path and local name are used when hashing. Each identifier in a module gets its own hash digest, always.'minimal-subset'Auto detect if identifier names can be omitted from hashing. Use this value to optimize the output for better GZIP or Brotli compression.
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
modules: {
hashStrategy: "minimal-subset",
},
},
},
],
},
};Type:
type localIdentRegExp = string | RegExp;Default: undefined
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
modules: {
localIdentRegExp: /page-(.*)\.css/i,
},
},
},
],
},
};Type:
type getLocalIdent = (
context: LoaderContext,
localIdentName: string,
localName: string,
) => string;Default: undefined
Allows to specify a function to generate the classname.
By default we use built-in function to generate a classname.
If your custom function returns null or undefined, the built-in generator is used as a fallback.
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
modules: {
getLocalIdent: (context, localIdentName, localName, options) => {
return "whatever_random_class_name";
},
},
},
},
],
},
};Type:
type namedExport = boolean;Default: Depends on the value of the esModule option. If the value of the esModule options is true, namedExport defaults to true ; otherwise, it defaults to false.
Enables or disables ES modules named export for locals.
Warning
The default class name cannot be used directly when namedExport is true because default is a reserved keyword in ECMAScript modules. It is automatically renamed to _default.
styles.css
.foo-baz {
color: red;
}
.bar {
color: blue;
}
.default {
color: green;
}index.js
import * as styles from "./styles.css";
// If using `exportLocalsConvention: "as-is"` (default value):
console.log(styles["foo-baz"], styles.bar);
// If using `exportLocalsConvention: "camel-case-only"`:
console.log(styles.fooBaz, styles.bar);
// For the `default` classname
console.log(styles["_default"]);You can enable ES module named export using:
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
esModule: true,
modules: {
namedExport: true,
},
},
},
],
},
};To set a custom name for namedExport, can use exportLocalsConvention option as a function.
See below in the examples section.
Type:
type exportsGLobals = boolean;Default: false
Allow css-loader to export names from global class or ID, so you can use that as local name.
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
modules: {
exportGlobals: true,
},
},
},
],
},
};Type:
type exportLocalsConvention =
| "as-is"
| "camel-case"
| "camel-case-only"
| "dashes"
| "dashes-only"
| ((name: string) => string);Default: Depends on the value of the modules.namedExport option:
- If
true-as-is - Otherwise
camel-case-only(class names converted to camelCase, original name removed).
Warning
Names of locals are converted to camelCase when the named export is false, i.e. the exportLocalsConvention option hascamelCaseOnly value by default.
You can set this back to any other valid option but selectors which are not valid JavaScript identifiers may run into problems which do not implement the entire modules specification.
Style of exported class names.
By default, the exported JSON keys mirror the class names (i.e as-is value).
| Name | Type | Description |
|---|---|---|
'as-is' |
string |
Class names will be exported as is. |
'camel-case' |
string |
Class names will be camelCased, but the original class name will not to be removed from the locals. |
'camel-case-only' |
string |
Class names will be camelCased, and original class name will be removed from the locals. |
'dashes' |
string |
Only dashes in class names will be camelCased |
'dashes-only' |
string |
Dashes in class names will be camelCased, the original class name will be removed from the locals |
file.css
.class-name {
}file.js
import { className } from "file.css";webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
modules: {
exportLocalsConvention: "camel-case-only",
},
},
},
],
},
};webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
modules: {
exportLocalsConvention: function (name) {
return name.replace(/-/g, "_");
},
},
},
},
],
},
};webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
modules: {
exportLocalsConvention: function (name) {
return [
name.replace(/-/g, "_"),
// dashesCamelCase
name.replace(/-+(\w)/g, (match, firstLetter) =>
firstLetter.toUpperCase(),
),
];
},
},
},
},
],
},
};Type:
type exportOnlyLocals = boolean;Default: false
Export only locals.
Useful when you use css modules for pre-rendering (for example SSR).
For pre-rendering with mini-css-extract-plugin you should use this option instead of style-loader!css-loader in the pre-rendering bundle.
It doesn't embed CSS; it only exports the identifier mappings.
webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
loader: "css-loader",
options: {
modules: {
exportOnlyLocals: true,
},
},
},
],
},
};Type:
type getJSON = ({
resourcePath,
imports,
exports,
replacements,
}: {
resourcePath: string;
imports: object[];
exports: object[];
replacements: object[];
}) => Promise<void> | void;Default: undefined
Enables a callback to output the CSS modules mapping JSON.
The callback is invoked with an object containing the following:
-
resourcePath: the absolute path of the original resource, e.g.,/foo/bar/baz.module.css -
imports: an array of import objects with data about import types and file paths, e.g.,
[
{
"type": "icss_import",
"importName": "___CSS_LOADER_ICSS_IMPORT_0___",
"url": "\"-!../../../../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].use[1]!../../../../../node_modules/postcss-loader/dist/cjs.js!../../../../../node_modules/sass-loader/dist/cjs.js!../../../../baz.module.css\"",
"icss": true,
"index": 0
}
](Note that this will include all imports, not just those relevant to CSS Modules.)
exports: an array of export objects with exported names and values, e.g.,
[
{
"name": "main",
"value": "D2Oy"
}
]replacements: an array of import replacement objects used for linkingimportsandexports, e.g.,
{
"replacementName": "___CSS_LOADER_ICSS_IMPORT_0_REPLACEMENT_0___",
"importName": "___CSS_LOADER_ICSS_IMPORT_0___",
"localName": "main"
}Using getJSON, it's possible to output a file with all CSS module mappings.
In the following example, we use getJSON to cache canonical mappings and add stand-ins for any composed values (through composes), and we use a custom plugin to consolidate the values and output them to a file:
webpack.config.js
const path = require("path");
const fs = require("fs");
const CSS_LOADER_REPLACEMENT_REGEX =
/(___CSS_LOADER_ICSS_IMPORT_\d+_REPLACEMENT_\d+___)/g;
const REPLACEMENT_REGEX = /___REPLACEMENT\[(.*?)]\[(.*?)]___/g;
const IDENTIFIER_REGEX = /\[(.*?)]\[(.*?)]/;
const replacementsMap = {};
const canonicalValuesMap = {};
const allExportsJson = {};
function generateIdentifier(resourcePath, localName) {
return `[${resourcePath}][${localName}]`;
}
function addReplacements(resourcePath, imports, exportsJson, replacements) {
const importReplacementsMap = {};
// create a dict to quickly identify imports and get their absolute stand-in strings in the currently loaded file
// e.g., { '___CSS_LOADER_ICSS_IMPORT_0_REPLACEMENT_0___': '___REPLACEMENT[/foo/bar/baz.css][main]___' }
importReplacementsMap[resourcePath] = replacements.reduce(
(acc, { replacementName, importName, localName }) => {
const replacementImportUrl = imports.find(
(importData) => importData.importName === importName,
).url;
const relativePathRe = /.*!(.*)"/;
const [, relativePath] = replacementImportUrl.match(relativePathRe);
const importPath = path.resolve(path.dirname(resourcePath), relativePath);
const identifier = generateIdentifier(importPath, localName);
return { ...acc, [replacementName]: `___REPLACEMENT${identifier}___` };
},
{},
);
// iterate through the raw exports and add stand-in variables
// ('___REPLACEMENT[<absolute_path>][<class_name>]___')
// to be replaced in the plugin below
for (const [localName, classNames] of Object.entries(exportsJson)) {
const identifier = generateIdentifier(resourcePath, localName);
if