Output dir should relative to root, not source dir
Opened this issue · 4 comments
There's an issue here and next line:
Line 125 in 59dc565
The outDir
parameter should be added relative to the original location of tsconfig.json
, not the baseUrl
, which is used for module resolution.
The current version works accidentally for "baseUrl": "./"
, but changing it to e.g. "baseUrl": "./src"
cause the following exception:
Error: ENOENT: no such file or directory, scandir 'F:\Repos\magiczny-miecz\MagicSword.Core\MagicSword.Core.Logic\ClientApp\src\dist\out-tsc' at Object.readdirSync (fs.js:759:3) at ParserEngine.walkSync (F:\Repos\magiczny-miecz\MagicSword.Core\MagicSword.Core.Logic\ClientApp\node_modules\tspath\src\parser-engine.js:260:24) at ParserEngine.execute (F:\Repos\magiczny-miecz\MagicSword.Core\MagicSword.Core.Logic\ClientApp\node_modules\tspath\src\parser-engine.js:101:14) at TSPath.processPath (F:\Repos\magiczny-miecz\MagicSword.Core\MagicSword.Core.Logic\ClientApp\node_modules\tspath\src\tspath.js:39:25) at Confirm.callback (F:\Repos\magiczny-miecz\MagicSword.Core\MagicSword.Core.Logic\ClientApp\node_modules\tspath\src\tspath.js:29:27) at Confirm.<anonymous> (F:\Repos\magiczny-miecz\MagicSword.Core\MagicSword.Core.Logic\ClientApp\node_modules\prompt-base\index.js:625:10) at runCallback (timers.js:696:18) at tryOnImmediate (timers.js:667:5) at processImmediate (timers.js:649:5)
while the output path here is still F:\Repos\magiczny-miecz\MagicSword.Core\MagicSword.Core.Logic\ClientApp\dist\out-tsc
Ups, I see there's a PR already pending, please add it and release a new version - your package is cool but this bug is a blocker.
Still broken and PR still pending. As @pgorczynski-df said: it doesn't work when you have a 'src' directory. That's unfortunate. 'Fortunately' enough, it 'accidentally works' without.
I ended up going with tsconfig-paths instead: https://github.com/dividab/tsconfig-paths. By adding a node require hook at runtime it gives you a way out of path hell as well, without needing to post-process your files. 🙂
@nilswxa FYI I ended up using https://www.npmjs.com/package/module-alias - did the job as well :)