You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Compiler outputs files to the wrong directory structure #5809
I've noticed a couple of issues with the way the compiler resolves the output directory structure. I've created a minimal project that can be used to reproduce these issues, it's setup as an NPM package, so after cloning/extracting run npm install to install the latest nightly build of TypeScript (support for filenames in the --project compiler option was added very recently).
Note that the output directory structure is missing the subdir second:
lib2/
file2.js
While the expected output directory structure is:
lib2/
second/
file2.js
Issue 2
I'm not sure if this is a bug or just user error, but it can be reproduced starting with TypeScript 1.6.2 (and possibly earlier, that's just the oldest version I've tried). Run
Thanks for the tip falsandtru (@falsandtru). Setting rootDir to . in bad-tsconfig.json does indeed solve the first issue, though it seems to me like that ought to be the default value of rootDir anyway.
Unfortunately I can't seem to fix the second issue by setting rootDir, I've tried modifying src/second/tsconfig.json like so:
Activity
falsandtru commentedon Nov 27, 2015
--rootDiroption will solve your issue. See: https://github.com/Microsoft/TypeScript/wiki/Compiler-Optionsenlight commentedon Nov 27, 2015
Thanks for the tip falsandtru (@falsandtru). Setting
rootDirto.in bad-tsconfig.json does indeed solve the first issue, though it seems to me like that ought to be the default value ofrootDiranyway.Unfortunately I can't seem to fix the second issue by setting
rootDir, I've tried modifyingsrc/second/tsconfig.jsonlike so:but the compiler then fails to find the source files:
falsandtru commentedon Nov 27, 2015
Correct code:
{ "compilerOptions": { "module": "commonjs", "target": "es6", "noImplicitAny": true, "sourceMap": false, "declaration": false, "noLib": false, "outDir": "../../lib3", "rootDir": ".." }, "files": [ "../first/file1.ts", "../second/file2.ts" ] }enlight commentedon Nov 27, 2015
That does indeed work, thanks falsandtru (@falsandtru).
falsandtru commentedon Nov 27, 2015
Not at all. Let's complete a issue with closing of it.
enlight commentedon Nov 27, 2015
For future reference, the explanation of the
rootDiroption in #2772 is vastly better than the two short sentences written about it in https://github.com/Microsoft/TypeScript/wiki/Compiler-Options