File tree 1 file changed +5
-7
lines changed
1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -86,20 +86,18 @@ function makeRequireFunction(mod, redirects) {
86
86
if ( destination === true ) {
87
87
missing = false ;
88
88
} else if ( destination ) {
89
- const href = destination . href ;
90
- if ( destination . protocol === 'node:' ) {
89
+ const { href, protocol } = destination ;
90
+ if ( protocol === 'node:' ) {
91
91
const specifier = destination . pathname ;
92
92
93
93
if ( BuiltinModule . canBeRequiredByUsers ( specifier ) ) {
94
94
const mod = loadBuiltinModule ( specifier , href ) ;
95
95
return mod . exports ;
96
96
}
97
97
throw new ERR_UNKNOWN_BUILTIN_MODULE ( specifier ) ;
98
- } else if ( destination . protocol === 'file:' ) {
99
- let filepath ;
100
- if ( urlToFileCache . has ( href ) ) {
101
- filepath = urlToFileCache . get ( href ) ;
102
- } else {
98
+ } else if ( protocol === 'file:' ) {
99
+ let filepath = urlToFileCache . get ( href ) ;
100
+ if ( ! filepath ) {
103
101
filepath = fileURLToPath ( destination ) ;
104
102
urlToFileCache . set ( href , filepath ) ;
105
103
}
You can’t perform that action at this time.
0 commit comments