-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add settings for multiple environments in tsconfig.json #9835
Comments
|
I am not a big fan of putting too much "intelligence" in tsconfig.json. I expect this file to be as close as possible to the compiler options. |
@mhegazy, true, but if I want to modify only a handful of settings per environment it would be a management nightmare if I had to maintain, say, a list of all the source files, if that's what my team chooses to do, in all three Remember, as currently implemented, overriding a Boolean flag is not an option in |
I would not say it is a nightmare. you also now have We really do not want to complicate the tsconfig.json setup. one thing to keep in mind, this is used by editors, and adding profiles and build variables makes it harder for these environments to work correctly. also once such requirements seem to be in the realm of build tools more than that of a compiler. having said that, we have talked about "inheriting" a tsconfig.json, so your smaller ones would point to a "main", and override it. we need to specify the behaviour of this though. //cc: @chuckjaz |
@clavecoder I've created a grunt plugin that does exactly that. instead of creating thousands of tsconfig.json files, the task create them programmatically. you can cascade / override the options as well, and reuse existing tsconfig files. |
I had thought "inheriting" (or "cascading") was already discounted. Is there still an open issue for it? The three I mentioned in the Prior Discussion section of my suggestion are all closed. "cascading"—tsconfig.json in subfolders—probably would not meet the user story in my suggestion; however, "inheriting" is something that would work. I had mentioned So either the "env" or "inerit" would suffice. My preference is for "env" since it maintains the "Only One File per Project" spirit that has guided However, a word about task runners.
With the move toward module loaders such as Since TypeScript targets large development projects, like enterprise applications, it should have some kind of native support for environment-based settings, which is well represented with prior art. |
here is the proposal for inheriting configurations: #9876 |
Looks like #9876 covers this request. |
Suggestion
Provide a feature similar to the
babelrc
fileenv
option so onetsconfig.json
file can support multiple environments. It is very cumbersome to have to maintain multipletsconfig.json
just so a few options can differ.Scenario
For latticework/jali, we use ava for unit testing which requires inline source maps to integrate with it's use of the Babel transpiler. However some of our code will be in a browser, and, for production use, we don't want have inline source maps in that scenario. It appears that now we have no recourse but to specify the source map option on the command line since (1)
--sourceMap
and--inlineSourceMap
are incompatable and (2) there is no way for a user to turn off a Boolean option from the command line.Prior Art
env
property inbabelrc
and inproject.json
so that the settings for each environment can be supported.Prior Discussion
A recent comment for #3645, made after the issue was closed, comes close to this idea.
The text was updated successfully, but these errors were encountered: