4

I'm trying to integrate an existing Angular 2 application into an existing ASP.NET Core project in Visual Studio. Both projects work independently, but when I try to compile the ASP.NET Core project in Visual Studio I get a bunch of typescript compilation errors related to files in the node_modules folder.

enter image description here

How do I:

  • Keep typescript from compiling at all
  • Keep the compiler from looking at anything in node_modules

I can get this to work by moving the node_modules folder out into the project root, but this would require completely rearranging the the original project dependencies and build files and I would prefer to avoid that.

3
  • 1. You can use "compileOnSave": true in tsconfig.json so whenever you save typescript it will compile. 2. you can move your tsconfig.json to low level folder where all your typescripts files are available. This way compiler will not look into node_modules folder at project root level. Commented Sep 26, 2016 at 6:11
  • Why don't you separate the Angular2 app from the Visual Studio Project? You could move the Angular2 App into the wwwroot after compiling all the stuff. Have you tried to 'exclude' the 'node_module' in the tsconfig file? "exclude": [ "node_modules" ] Commented Sep 26, 2016 at 6:14
  • I've already excluded the folder - it turns out though the problem is the typings folder. I don't want to separate the project out because in the end the app will all run in a single domain/virtual. I've moved everything down to the root and build into the wwwroot folder which was easy enough, but still VS compiles. I really just want VIsual Studio not to touch my TS code at all. Commented Sep 26, 2016 at 6:33

1 Answer 1

8

-1-. You can disable typescript compiling by editing project file (.xproj). Add this block:

<PropertyGroup>
    <TypeScriptCompileBlocked>True</TypeScriptCompileBlocked>
</PropertyGroup>   

-2-. To keep the compiler from looking at anything in node_modules - use exclude in tsconfig:

"exclude":[
  "node_modules"
]

* Path to node_modules is relative to tsconfig.json

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.