File tree 5 files changed +27
-2
lines changed
test/fixtures/react-css-modules/does not throw error on excluded JSXElement
5 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 4
4
"start" : " webpack-dev-server"
5
5
},
6
6
"dependencies" : {
7
- "babel-plugin-react-css-modules" : " ^2.1.3 " ,
7
+ "babel-plugin-react-css-modules" : " ^4.0.0 " ,
8
8
"react" : " ^15.4.1" ,
9
9
"react-dom" : " ^15.4.1" ,
10
10
"webpack" : " ^2.7.0"
Original file line number Diff line number Diff line change @@ -121,6 +121,10 @@ export default ({
121
121
return require . resolve ( path . node . source . value ) ;
122
122
} ;
123
123
124
+ const isFilenameExcluded = ( filename , exclude ) => {
125
+ return filename . match ( new RegExp ( exclude ) ) ;
126
+ } ;
127
+
124
128
const notForPlugin = ( path : * , stats : * ) => {
125
129
stats . opts . filetypes = stats . opts . filetypes || { } ;
126
130
@@ -130,7 +134,9 @@ export default ({
130
134
return true ;
131
135
}
132
136
133
- if ( stats . opts . exclude && getTargetResourcePath ( path , stats ) . match ( new RegExp ( stats . opts . exclude ) ) ) {
137
+ const filename = getTargetResourcePath ( path , stats ) ;
138
+
139
+ if ( stats . opts . exclude && isFilenameExcluded ( filename , stats . opts . exclude ) ) {
134
140
return true ;
135
141
}
136
142
@@ -179,6 +185,10 @@ export default ({
179
185
JSXElement ( path : * , stats : * ) : void {
180
186
const filename = stats . file . opts . filename ;
181
187
188
+ if ( stats . opts . exclude && isFilenameExcluded ( filename , stats . opts . exclude ) ) {
189
+ return ;
190
+ }
191
+
182
192
let attributeNames = optionsDefaults . attributeNames ;
183
193
184
194
if ( stats . opts && stats . opts . attributeNames ) {
Original file line number Diff line number Diff line change
1
+ < div styleName = "missing_import" />
Original file line number Diff line number Diff line change
1
+ {
2
+ "plugins" : [
3
+ [
4
+ " ../../../../src" ,
5
+ {
6
+ "generateScopedName" : " [name]__[local]" ,
7
+ "exclude" : " input"
8
+ }
9
+ ]
10
+ ]
11
+ }
Original file line number Diff line number Diff line change
1
+ "use strict" ;
2
+
3
+ < div styleName = "missing_import" /> ;
You can’t perform that action at this time.
0 commit comments