Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Core Project: How to keep Typescript from Compiling

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.

like image 873
Rick Strahl Avatar asked Feb 07 '23 01:02

Rick Strahl


1 Answers

-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

like image 93
Aleksey L. Avatar answered Apr 01 '23 16:04

Aleksey L.