| import path from 'path'; |
| import { pathToFileURL } from 'url'; |
| |
| import { resolve as resolveTs } from 'ts-node/esm'; |
| import * as tsConfigPaths from 'tsconfig-paths'; |
|
|
| |
| const { absoluteBaseUrl, paths } = tsConfigPaths.loadConfig( |
| path.resolve('./tsconfig.json'), |
| ); |
| const matchPath = tsConfigPaths.createMatchPath(absoluteBaseUrl, paths); |
|
|
| export function resolve(specifier, context, defaultResolve) { |
| const match = matchPath(specifier); |
| if (match) { |
| return resolveTs(pathToFileURL(match).href, context, defaultResolve); |
| } |
| return resolveTs(specifier, context, defaultResolve); |
| } |
|
|
| |
| export { load, getFormat, transformSource } from 'ts-node/esm'; |
| |