File tree Expand file tree Collapse file tree 5 files changed +27
-2
lines changed
test/fixtures/react-css-modules/does not throw error on excluded JSXElement Expand file tree Collapse file tree 5 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 44 "start" : " webpack-dev-server"
55 },
66 "dependencies" : {
7- "babel-plugin-react-css-modules" : " ^2.1.3 " ,
7+ "babel-plugin-react-css-modules" : " ^4.0.0 " ,
88 "react" : " ^15.4.1" ,
99 "react-dom" : " ^15.4.1" ,
1010 "webpack" : " ^2.7.0"
Original file line number Diff line number Diff line change @@ -121,6 +121,10 @@ export default ({
121121 return require . resolve ( path . node . source . value ) ;
122122 } ;
123123
124+ const isFilenameExcluded = ( filename , exclude ) => {
125+ return filename . match ( new RegExp ( exclude ) ) ;
126+ } ;
127+
124128 const notForPlugin = ( path : * , stats : * ) => {
125129 stats . opts . filetypes = stats . opts . filetypes || { } ;
126130
@@ -130,7 +134,9 @@ export default ({
130134 return true ;
131135 }
132136
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 ) ) {
134140 return true ;
135141 }
136142
@@ -179,6 +185,10 @@ export default ({
179185 JSXElement ( path : * , stats : * ) : void {
180186 const filename = stats . file . opts . filename ;
181187
188+ if ( stats . opts . exclude && isFilenameExcluded ( filename , stats . opts . exclude ) ) {
189+ return ;
190+ }
191+
182192 let attributeNames = optionsDefaults . attributeNames ;
183193
184194 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