Skip to content

tsconfig breaks TSC in VS 2015 #4161

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

Closed
glatzert opened this issue Aug 5, 2015 · 20 comments
Closed

tsconfig breaks TSC in VS 2015 #4161

glatzert opened this issue Aug 5, 2015 · 20 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue Visual Studio Integration with Visual Studio

Comments

@glatzert
Copy link

glatzert commented Aug 5, 2015

Placing a tsconfig.json file inside of an ASP.NET vNext Project (beta6) will break tsc.
It will not produce any output.or overwrite files or whatever else.
Removing the tsconfig.json fixes the automatic compilation.

@danquirk danquirk added Bug A bug in TypeScript Visual Studio Integration with Visual Studio labels Aug 5, 2015
@mhegazy
Copy link
Contributor

mhegazy commented Aug 5, 2015

@paulvanbrenk can you take a look/provide a workaround here?

@mhegazy mhegazy assigned mhegazy and paulvanbrenk and unassigned mhegazy Aug 5, 2015
@mhegazy mhegazy added this to the TypeScript 1.6 milestone Aug 5, 2015
@paulvanbrenk
Copy link
Contributor

only the following setup is supported at this time

/projectroot
    /wwwroot
    /scripts
        - tsconfig.json
        - ts files

For compile on save to work you need to enable Compile on save for files that are not part of a project, in tools/options/text editor/typescript/project

hope this helps

@mhegazy
Copy link
Contributor

mhegazy commented Aug 5, 2015

also to note, this is something we are still working on. TypeScript 1.5 release went out before ASP.Net release, so there are some missing support that we need to update in the next release. sorry for the hassle.

@glatzert
Copy link
Author

glatzert commented Aug 6, 2015

Well okay - the currently supported setup works - but orignially we wanted to go by one file per Module, which is not accomplishable without multiple tsconfig files, but with a buildstep - so we will use that as a Workaround.
Thanks

@paulvanbrenk
Copy link
Contributor

Can you describe how you would like to setup your project to do 'one file per module', so we can take that into account when we improve the tsconfig experience in the near future.

@glatzert
Copy link
Author

Well we'd like to use something like this:

 /projectroot
    /scripts
        /module1
            - sourceFile1.ts
            - sourceFile2.ts
            - sourceFile3.ts
            - tsconfig.json
        /module2
            - sourceFile4.ts
            - sourceFile5.ts
            - tsconfig.json
        /module3
            - sourceFile6.ts
            - sourceFile7.ts
            - tsconfig.json

Which should be build into this:

 /projectroot
    /wwwroot/js
        -Module1.js/map.js/min.js
        -Module2.js/map.js/min.js
        -Module3.js/map.js/min.js

Currently we can only make one js file per ts file or one js file with all the code. (The latter `out: "../wwwroot/js/Output.js"´ seems not to work either.)

@paulvanbrenk
Copy link
Contributor

@glatzert thanks, this is good feedback.

You should be able to enable this scenario right now using a grunt task, however I don't think there is any good information available right now (I couldn't find any just now). And I have to make sure that works with compile on save. I'll add some information to the ASP.NET + TypeScript wiki this week.

@paulvanbrenk paulvanbrenk added Bug A bug in TypeScript and removed Bug A bug in TypeScript labels Aug 12, 2015
@ISkomorokh
Copy link

I'm trying to write simple spa using VS 2015 RTM, ASP.NET 5, TypeScript and Aurelia. I have tried the setup that was proposed here earlier, but didn't succeed.

/projectroot
    /wwwroot
       /jspm_packages
    /scripts
        - tsconfig.json
        - ts files

I had to follow these instructions to make everything work well. Hope I won't need to copy *.d.ts into script\typings folder in the nearest future.

Thanks

@ghost
Copy link

ghost commented Sep 2, 2015

Hi guys,

I'm building a standalone TypeScript app with a similar folder structure and output to glatzert above. We need to build several .ts files in a folder to one combined .js file. Is there any update on when this tsconfig issue will be resolved? I see it was marked initially for 1.6 but is now pushed to 1.6.2, will it be released with 1.6.2?

Thanks,
Stephen

@paulvanbrenk
Copy link
Contributor

@swilson128 It will work in 1.6 with the tsconfig.json file in the scripts folder, using this issue to track putting the tsconfig.json file in any directory.

@aaron-bond
Copy link

@paulvanbrenk so we will eventually be able to do the following?

/Common.Classes
   - tsconfig.json {out: "../Outputs/Common.Classes.js"}
   - Class1.ts
   - Class2.ts

/Common.Plugins
   - tsconfig.json {out: "../Outputs/Common.Plugins.js"}
   - Class3.ts
   - Class4.ts

/Outputs
   - Common.Classes.js
   - Common.Plugins.js

@paulvanbrenk
Copy link
Contributor

@aaron-bond yes that's the goal, however you'll have to switch to use the new outFile property in the tsconfig file.

@aaron-bond
Copy link

@paulvanbrenk that's great news for us. We're planning a project for some time in the future. Is there a time frame on the outFile property being available?

@paulvanbrenk
Copy link
Contributor

@aaron-bond the outFile property is in TS 1.6 Beta, it replaces out; the support for the multiple tsconfig files in a single Visual Studio project should be in the next release of TS for VS, but there are some open questions on how to handle ordering of compilations and how to show errors in VS.

@paulvanbrenk
Copy link
Contributor

Closing this thread as the original issue with the tsconfig.json file in the root of the project is fixed in the final release of 1.6.

The support for multiple tsconfig.json files is tracked in issue #4714

@paulvanbrenk paulvanbrenk added the Fixed A PR has been merged for this issue label Sep 9, 2015
@Denis535
Copy link

mhegazy, how does TypeScript depend on Asp.Net? Because TS is front-end and Asp.net is back-end. I thought TypeScript is using only Node.js.

If tsconfig.json support is done, update this https://github.com/microsoft/TypeScript/wiki/Using-TypeScript-With-ASP.NET-5

I don't understand can I use tsconfig in HTML With TypeScript project type?
Is this issue specific to Asp.net project type or and for HTML with TypeScript?

@mhegazy
Copy link
Contributor

mhegazy commented Apr 30, 2016

how does TypeScript depend on Asp.Net? Because TS is front-end and Asp.net is back-end. I thought TypeScript is using only Node.js

TypeScript VS plugin does not depend on niether ASP.net nor nodejs.

I don't understand can I use tsconfig in HTML With TypeScript project type?

yes you can with TS 1.8/VS2015 update 2. Just add a tsconfig.json file to your project and it should just work.

Is this issue specific to Asp.net project type or and for HTML with TypeScript?

nope. works in all project kinds.

If tsconfig.json support is done, update this https://github.com/microsoft/TypeScript/wiki/Using-TypeScript-With-ASP.NET-5

looged issue #8402 to update the docs. for now here is a better tutorial for ASP.Net and TS: https://github.com/Microsoft/TypeScript-Handbook/blob/master/pages/quick-start/asp-net-core.md

@Denis535
Copy link

Denis535 commented Apr 30, 2016

TypeScript 1.5 release went out before ASP.Net release, so there are some missing support that we need to update in the next release.

What did you mean then?

TypeScript VS plugin does not depend on niether ASP.net nor nodejs.

TypeScript Compiler is running via node.js? So, it indirectly depend on node.js )

Just add a tsconfig.json file to your project and it should just work.

Ok. But I still don't understand how does msbuild and tsconfig cooperate.
UPDATE:
Okey. I read release-notes of TypeScript 1.8, chapter "Improved support for tsconfig.json in Visual Studio 2015". Now I understand it.
Would be good if you provide a document where you describe how Visual Studio TypeScript Plugin does work. Because people usually don't read release-notes.

@fis-cz
Copy link

fis-cz commented Apr 15, 2017

I have found another workaround for this. If I have tsconfig.json file in project and I set Build Action to None for each and every .ts file in the project the conflict disappears and tsconfig is used instead. Build actions such as Build/Clean seems to be working fine. Bit painful, especially when I have tons of ts files inside but works well. To simplify this, open .csproj in notepad and replace all occurences of TypeScriptCompile to None :) Or create a project pre-build action which will take care of it in case the tsconfig.json exist in the project root.

@fis-cz
Copy link

fis-cz commented Apr 15, 2017

I am sorry, its bit more complicated, but I still have similar workaround.

a) set all .ts files build action to None
b) create a vsfix.ts file, keep it empty and keep Build Action on TypeScriptCompile
c) create post-build task: tsc -p "$(ProjectDir)tsconfig.json"

In this case build/clean including tslint and build error reporting works well if the single file is used as a TypeScript compiler (outFile option)

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue Visual Studio Integration with Visual Studio
Projects
None yet
Development

No branches or pull requests

8 participants