File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -173,7 +173,7 @@ export function readConfig(
173
173
if ( options . require ) {
174
174
// Modules are found relative to the tsconfig file, not the `dir` option
175
175
const tsconfigRelativeResolver =
176
- createProjectLocalResolveHelper ( configPath ) ;
176
+ createProjectLocalResolveHelper ( dirname ( configPath ) ) ;
177
177
options . require = options . require . map ( ( path : string ) =>
178
178
tsconfigRelativeResolver ( path , false )
179
179
) ;
Original file line number Diff line number Diff line change 4
4
} from 'module' ;
5
5
import type _createRequire from 'create-require' ;
6
6
import * as ynModule from 'yn' ;
7
+ import { dirname } from 'path' ;
7
8
8
9
/** @internal */
9
10
export const createRequire =
@@ -149,5 +150,9 @@ export function getBasePathForProjectLocalDependencyResolution(
149
150
projectOption : string | undefined ,
150
151
cwdOption : string
151
152
) {
152
- return configFilePath ?? projectSearchDirOption ?? projectOption ?? cwdOption ;
153
+ if ( configFilePath != null ) return dirname ( configFilePath ) ;
154
+ return projectSearchDirOption ?? projectOption ?? cwdOption ;
155
+ // TODO technically breaks if projectOption is path to a file, not a directory,
156
+ // and we attempt to resolve relative specifiers. By the time we resolve relative specifiers,
157
+ // should have configFilePath, so not reach this codepath.
153
158
}
You can’t perform that action at this time.
0 commit comments