2024-09-11 21:28:41 +02:00

16 lines
579 B
JavaScript

import { resolve as resolveTs } from 'ts-node/esm.mjs';
import { loadConfig, createMatchPath } from 'tsconfig-paths';
import { pathToFileURL } from 'url';
const { absoluteBaseUrl, paths } = loadConfig('.nuxt');
const matchPath = createMatchPath(absoluteBaseUrl, paths);
export async function resolve(specifier, ctx, defaultResolve) {
const match = matchPath(specifier);
return match
? resolveTs(pathToFileURL(`${match}`).href, ctx, defaultResolve)
: resolveTs(specifier, ctx, defaultResolve);
}
export { load, transformSource } from 'ts-node/esm.mjs';