import { relative, dirname } from "path"; import _locreq from "locreq"; const target_locreq = _locreq(process.cwd()); export function importPath( project_module_path: string, project_target_path: string ): string { let result = relative( dirname(target_locreq.resolve(project_module_path)), target_locreq.resolve(project_target_path).replace(/.tsx?$/, ".js") ); if (result[0] != ".") { result = "./" + result; } return result; } export function curryImportPath( project_module_path: string ): (project_target_path: string) => string { return function (project_target_path: string) { return importPath(project_module_path, project_target_path); }; }