Skip to content

Commit 85a3723

Browse files
authored
fix a bug in classname replacing (#22)
1 parent 1d71e3b commit 85a3723

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ const buildCssModulesJS2 = async (cssFullPath) => {
4545
const patchedClass = exports[originClass].name;
4646
cssModulesJSON[camelCase(originClass)] = classPrefix + patchedClass;
4747
finalCssContent = finalCssContent.replace(
48-
new RegExp(patchedClass, 'g'),
49-
classPrefix + patchedClass
48+
new RegExp(`\\.${patchedClass}`, 'g'),
49+
'.' + classPrefix + patchedClass
5050
)
5151
});
5252
const classNames = JSON.stringify(cssModulesJSON, null, 2);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "esbuild-css-modules-plugin",
3-
"version": "2.1.4",
3+
"version": "2.1.5",
44
"description": "A esbuild plugin to bundle css modules into js(x)/ts(x).",
55
"main": "index.js",
66
"keywords": [

0 commit comments

Comments
 (0)