Reputation: 1566
I want to compile a new js folder for each script folder. Is that possible with tsconfig.json
?
Directories
folder1
scripts
index.ts
folder2
scripts
index.ts
tsconfig.json
Directories after compile
folder1
scripts
index.ts
js
index.js
folder2
scripts
index.ts
js
index.js
tsconfig.json
Upvotes: 0
Views: 180
Reputation: 250922
Disclaimer... this doesn't answer your question specifically, because what you want to do breaks with convention. Even if you manage to do it your way, I think you'll find the pain will outweigh the benefit.
The simplest way is to specify an outDir
output directory. Your existing folder structure will be maintained in the output directory, with all the JavaScript and TypeScript kept cleanly separated.
{
"compilerOptions": {
"outDir": "./scripts",
...
}
}
So if you start with:
/component-a
index.ts
/component-b
index.ts
You'll end up with the folders mirrored in the output directory.
/component-a
index.ts
/component-b
index.ts
/scripts
/component-a
index.js
/component-b
index.js
Unless you plan to deploy both (?) you don't normally want the TypeScript and JavaScript intermingled.
Upvotes: 1