Skip to content
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

TSC fails when having Angular2 referenced in Visual Studio project #6087

Closed
SetTrend opened this issue Dec 13, 2015 · 6 comments
Closed

TSC fails when having Angular2 referenced in Visual Studio project #6087

SetTrend opened this issue Dec 13, 2015 · 6 comments
Labels
Question An issue which isn't directly actionable in code

Comments

@SetTrend
Copy link

After having set tsconfig.json according to documentation, TSC fails, claiming that it required Angular2 TypeScript sources:

typescript compiler fails

Angular2 isn't part of my project. Providing a rootDir option to tsconfig.json should even confirm that the Angular2 sources are not supposed to be compiled by TSC.

The default Visual Studio TSC configuration should exclude node_modules path by default. Why does it still try to compile the Angular2 module?

@DanielRosenwasser
Copy link
Member

The default tsconfig.json has node_modules excluded by default, but it is not implicit because not every user necessarily wants that behavior. You'll need to add it yourself.

@DanielRosenwasser DanielRosenwasser added the Question An issue which isn't directly actionable in code label Dec 14, 2015
@SetTrend
Copy link
Author

Thank you for enlightening me on this.

I see. Please allow me these follow-up questions:

  • Can I edit the default tsconfig.json file on my machine?
  • Is there a switch available in Visual Studio (Tools > Options ...) to have TSC log it's actions to the output window messages like:
    • Searching @ ...\...\ due to 'rootDir' setting
    • Ignoring folders '...\...\', '...\...\' due to 'exclude' setting
    • ...
  • Doesn't the rootDir setting restrict the search path to that root dir? If it doesn't, then why? Which switch does?

@SetTrend
Copy link
Author

I just moved the tsconfig.json file up the hierarchy to be applied only to the /scripts/ folder, but to no avail: Although the /node_modules/ folder is now outside the tsconfig.json, it's still being considered by TSC.

typescript compiler fails

I wonder how the statement given in #3645 ("you can have multiple tsconfig today, each pointing to overlapping set of files. so one at src\tsconfig.json, one in tests\tsconfig.json, etc.") will actually be working.

@DanielRosenwasser
Copy link
Member

Can I edit the default tsconfig.json file on my machine?

You can feed options into tsc when you use tsc --init.

Is there a switch available in Visual Studio (Tools > Options ...) to have TSC log it's actions to the output window

Unfortunately not as of present, though @paulvanbrenk might want a heads up on that.

Doesn't the rootDir setting restrict the search path to that root dir? If it doesn't, then why? Which switch does?

I'm not entirely certain; rootDir will inform the directory structure to use when using outDir. While it would make sense to inform the compilation scope here, I think it would be ideal to keep the behavior simple.


As a follow up, let me just confirm the major problem here: the Angular 2 .ts files in node_modules are giving errors when using rootDir, even when you add node_modules to your "excludes"?

@billti
Copy link
Member

billti commented Dec 16, 2015

I'm not sure I'm fully following. Are you able to provide the project so I can load it up and see what is happening first hand? Is this only a problem if the rootDir option is provided?

If interested, I just got a skeleton ASP.NET 5 RC with Angular2 Beta solution running VS2015. I uploaded it to https://github.com/billti/ASPNET5-with-Angular2 . Take a look and see if anything in here helps in terms of configuration or setup.

@SetTrend
Copy link
Author

Yes, it looks like the error still appears after having set the "exclude" config setting:

tsconfig


Here's a link to the respository: https://github.com/SetTrend/AspNet.Security.OpenIdConnect.Samples

The actual project I'm working with within this solution is @ "...\samples\Multiple Projects Sample\Clients\AngularClient"

@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
Question An issue which isn't directly actionable in code
Projects
None yet
Development

No branches or pull requests

3 participants