Closed
Description
I am using an import within a Ts source file:
import { TsCore } from "@TsToolsCommon/Utils/TsCore";
This import gets resolved correctly:
======== Resolving module '@TsToolsCommon/Utils/TsCore' from 'C:/Users/Administrator/Source/Repos/TsTools/Ts2Js/src/TsCompi
56D0
ler.ts'. ========
Explicitly specified module resolution kind: 'NodeJs'.
'baseUrl' option is set to 'C:/Users/Administrator/Source/Repos/TsTools/Ts2Js/src', using this value to resolve non-relative module name '@TsToolsCommon/Utils/TsCore'.
'paths' option is specified, looking for a pattern to match module name '@TsToolsCommon/Utils/TsCore'.
Module name '@TsToolsCommon/Utils/TsCore', matched pattern '@TsToolsCommon/*'.
Trying substitution '../../TsToolsCommon/src/*', candidate module location: '../../TsToolsCommon/src/Utils/TsCore'.
Loading module as file / folder, candidate module location 'C:/Users/Administrator/Source/Repos/TsTools/TsToolsCommon/src/Utils/TsCore', target file type 'TypeScript'.
File 'C:/Users/Administrator/Source/Repos/TsTools/TsToolsCommon/src/Utils/TsCore.ts' exist - use it as a name resolution result.
In the tsconfig.json, I have:
"baseUrl": ".",
"paths": {
"@TsToolsCommon/*": [ "../../TsToolsCommon/src/*" ]
}
The require() in the compiled js output is:
var TsCore_1 = require("@TsToolsCommon/Utils/TsCore");
I expected that this would be resolved to the full relative path.
This causes grief in mocha test resolution as the "@TsToolsCommon/Utils/TsCore" module cannot be found.