Skip to content

Commit 12eecfa

Browse files
committed
fix: getClassName now works as expected when multiple file use runtime resolution
1 parent f14a4f4 commit 12eecfa

File tree

5 files changed

+37
-0
lines changed

5 files changed

+37
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import bar from './bar.css';
2+
import './foo.css';
3+
4+
const styleNameBar = 'bar.a-b';
5+
const styleNameFoo = 'a-b';
6+
7+
<div styleName={styleNameBar}></div>;
8+
<div styleName={styleNameFoo}></div>;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.a-b {}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import _getClassName from 'babel-plugin-react-css-modules/dist/browser/getClassName';
2+
import bar from './bar.css';
3+
import './foo.css';
4+
5+
const _styleModuleImportMap = {
6+
'bar': {
7+
'a-b': 'bar__a-b'
8+
},
9+
'random-test': {
10+
'a-b': 'foo__a-b'
11+
}
12+
};
13+
const styleNameBar = 'bar.a-b';
14+
const styleNameFoo = 'a-b';
15+
16+
<div styleName={_getClassName(styleNameBar, _styleModuleImportMap)}></div>;
17+
<div styleName={_getClassName(styleNameFoo, _styleModuleImportMap)}></div>;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.a-b {}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"plugins": [
3+
[
4+
"../../../../src",
5+
{
6+
"generateScopedName": "[name]__[local]"
7+
}
8+
]
9+
]
10+
}

0 commit comments

Comments
 (0)