File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -18,14 +18,17 @@ export default function(
1818 if ( source ) {
1919 let path = source . fileName ;
2020 let fileName = path . replace ( BEFORE_SLASH_RE , '' ) ;
21- if ( / ^ i n d e x \. / . test ( fileName ) ) {
22- // Special case: include closest folder name for `index.*` filenames.
23- const match = path . match ( BEFORE_SLASH_RE ) ;
24- if ( match ) {
25- const pathBeforeSlash = match [ 1 ] ;
26- if ( pathBeforeSlash ) {
27- const folderName = pathBeforeSlash . replace ( BEFORE_SLASH_RE , '' ) ;
28- fileName = folderName + '/' + fileName ;
21+ if ( __DEV__ ) {
22+ // In DEV, include code for a common special case:
23+ // prefer "folder/index.js" instead of just "index.js".
24+ if ( / ^ i n d e x \. / . test ( fileName ) ) {
25+ const match = path . match ( BEFORE_SLASH_RE ) ;
26+ if ( match ) {
27+ const pathBeforeSlash = match [ 1 ] ;
28+ if ( pathBeforeSlash ) {
29+ const folderName = pathBeforeSlash . replace ( BEFORE_SLASH_RE , '' ) ;
30+ fileName = folderName + '/' + fileName ;
31+ }
2932 }
3033 }
3134 }
You can’t perform that action at this time.
0 commit comments