@@ -44,15 +44,25 @@ const checkFileExtensionsUntilItExists = (
44
44
) : string | undefined => {
45
45
if ( existsSync ( `${ pathWithoutExtension } .ts` ) ) {
46
46
return `${ pathWithoutExtension } .ts` ;
47
- } else if ( existsSync ( `${ pathWithoutExtension } .tsx` ) ) {
47
+ }
48
+
49
+ if ( existsSync ( `${ pathWithoutExtension } .tsx` ) ) {
48
50
return `${ pathWithoutExtension } .tsx` ;
49
- } else if ( existsSync ( `${ pathWithoutExtension } .js` ) ) {
51
+ }
52
+
53
+ if ( existsSync ( `${ pathWithoutExtension } .js` ) ) {
50
54
return `${ pathWithoutExtension } .js` ;
51
- } else if ( existsSync ( `${ pathWithoutExtension } .jsx` ) ) {
55
+ }
56
+
57
+ if ( existsSync ( `${ pathWithoutExtension } .jsx` ) ) {
52
58
return `${ pathWithoutExtension } .jsx` ;
53
- } else if ( existsSync ( `${ pathWithoutExtension } .mjs` ) ) {
59
+ }
60
+
61
+ if ( existsSync ( `${ pathWithoutExtension } .mjs` ) ) {
54
62
return `${ pathWithoutExtension } .mjs` ;
55
- } else if ( existsSync ( `${ pathWithoutExtension } .cjs` ) ) {
63
+ }
64
+
65
+ if ( existsSync ( `${ pathWithoutExtension } .cjs` ) ) {
56
66
return `${ pathWithoutExtension } .cjs` ;
57
67
}
58
68
} ;
@@ -133,9 +143,12 @@ export const createDependencyGraph = async (directory: string) => {
133
143
const pathWithExtension = checkFileExtensionsUntilItExists (
134
144
pathToDependencyFromDirectory ,
135
145
) ;
146
+
136
147
if ( pathWithExtension ) {
137
148
pathToDependencyFromDirectory = pathWithExtension ;
138
- } else if ( isDev ) {
149
+ }
150
+
151
+ if ( isDev ) {
139
152
// only warn about this on development as it is probably going to be irrelevant otherwise
140
153
console . warn (
141
154
`Could not determine the file extension for the file at ${ pathWithExtension } ` ,
0 commit comments