When running tsc
how do we exclude the src
folder (Root containing folder) from output? I have the outDir
set to target
and instead of target/src/file.ts
I would like target/file.ts
?
When running tsc
how do we exclude the src
folder (Root containing folder) from output? I have the outDir
set to target
and instead of target/src/file.ts
I would like target/file.ts
?
- Do you have all your code in the src folder? – Simeon Smith Commented Jul 12, 2018 at 22:37
- I'm assuming this question is related to your last one? – Patrick Roberts Commented Jul 12, 2018 at 22:37
-
@PatrickRoberts it's related in the sense that I'm pursuing creating a clean
dist or target
directory to publish from...Would be a lot easier if there was abase
package.json property though ... :) – Ole Commented Jul 12, 2018 at 22:39 -
1
How about using the
"include"
option in your tsconfig? So something like{"pilerOptions": { ... }, "include": [ "./src/" ]}
? – CRice Commented Jul 12, 2018 at 23:01 - 1 You're going to want a different tsc mand to pile your tests. You can't do both at the same time and have the src not pile to the same folder. You can chain the mands though. – Simeon Smith Commented Jul 13, 2018 at 2:53
1 Answer
Reset to default 6Your probably looking for the rootDir tsconfig option. Specifically, in your case: rootDir: 'src/'
, supposing your keeping all source files under ./src/ and your tsconfig.json at the level above src/.
Note however, tsc
may silently ignore this setting if your actually importing files that aren't under src/
, say for example you import your package.json from top level.