@@ -64,7 +64,7 @@ export function resolve(
64
64
}
65
65
66
66
initMappers ( options )
67
- const mappedPath = getMappedPath ( source , file )
67
+ const mappedPath = getMappedPath ( source )
68
68
if ( mappedPath ) {
69
69
log ( 'matched ts path:' , mappedPath )
70
70
}
@@ -153,19 +153,15 @@ function removeJsExtension(id: string) {
153
153
}
154
154
155
155
let mappersBuildForOptions : TsResolverOptions
156
- let mappers :
157
- | Array < ( source : string , file : string ) => string | undefined >
158
- | undefined
156
+ let mappers : Array < ( source : string ) => string | undefined > | undefined
159
157
160
158
/**
161
159
* @param {string } source the module to resolve; i.e './some-module'
162
160
* @param {string } file the importing file's full path; i.e. '/usr/local/bin/file.js'
163
161
* @returns The mapped path of the module or undefined
164
162
*/
165
- function getMappedPath ( source : string , file : string ) {
166
- const paths = mappers !
167
- . map ( mapper => mapper ( source , file ) )
168
- . filter ( path => ! ! path )
163
+ function getMappedPath ( source : string ) {
164
+ const paths = mappers ! . map ( mapper => mapper ( source ) ) . filter ( path => ! ! path )
169
165
170
166
if ( paths . length > 1 ) {
171
167
log ( 'found multiple matching ts paths:' , paths )
@@ -230,12 +226,7 @@ function initMappers(options: TsResolverOptions) {
230
226
configLoaderResult . paths ,
231
227
)
232
228
233
- return ( source : string , file : string ) => {
234
- // exclude files that are not part of the config base url
235
- if ( ! file . includes ( configLoaderResult . absoluteBaseUrl ) ) {
236
- return
237
- }
238
-
229
+ return ( source : string ) => {
239
230
// look for files based on setup tsconfig "paths"
240
231
return matchPath (
241
232
source ,
0 commit comments