File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -119,9 +119,12 @@ if (!__dirname.match(new RegExp(`\\${path.sep}node_modules\\${path.sep}`))) {
119
119
120
120
Module . _resolveFilename = function ( request , parent ) {
121
121
let resolved = null ;
122
+ let exception ;
122
123
try {
123
124
resolved = oldResolve . call ( this , request , parent ) ;
124
- } catch ( _ ) { }
125
+ } catch ( e ) {
126
+ exception = e ;
127
+ }
125
128
126
129
if ( request in packages ) {
127
130
return packages [ request ] . main ;
@@ -135,6 +138,12 @@ if (!__dirname.match(new RegExp(`\\${path.sep}node_modules\\${path.sep}`))) {
135
138
if ( match ) {
136
139
const p = path . join ( packages [ match ] . root , request . substr ( match . length ) ) ;
137
140
return oldResolve . call ( this , p , parent ) ;
141
+ } else if ( ! resolved ) {
142
+ if ( exception ) {
143
+ throw exception ;
144
+ } else {
145
+ return resolved ;
146
+ }
138
147
} else {
139
148
// Because loading `.ts` ends up AFTER `.json` in the require() logic, requiring a file that has both `.json`
140
149
// and `.ts` versions will only get the `.json` content (which wouldn't happen if the .ts was compiled to
You can’t perform that action at this time.
0 commit comments