@@ -64,7 +64,7 @@ export function resolve(
6464 }
6565
6666 initMappers ( options )
67- const mappedPath = getMappedPath ( source , file )
67+ const mappedPath = getMappedPath ( source )
6868 if ( mappedPath ) {
6969 log ( 'matched ts path:' , mappedPath )
7070 }
@@ -153,19 +153,15 @@ function removeJsExtension(id: string) {
153153}
154154
155155let mappersBuildForOptions : TsResolverOptions
156- let mappers :
157- | Array < ( source : string , file : string ) => string | undefined >
158- | undefined
156+ let mappers : Array < ( source : string ) => string | undefined > | undefined
159157
160158/**
161159 * @param {string } source the module to resolve; i.e './some-module'
162160 * @param {string } file the importing file's full path; i.e. '/usr/local/bin/file.js'
163161 * @returns The mapped path of the module or undefined
164162 */
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 )
169165
170166 if ( paths . length > 1 ) {
171167 log ( 'found multiple matching ts paths:' , paths )
@@ -230,12 +226,7 @@ function initMappers(options: TsResolverOptions) {
230226 configLoaderResult . paths ,
231227 )
232228
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 ) => {
239230 // look for files based on setup tsconfig "paths"
240231 return matchPath (
241232 source ,
0 commit comments