Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to exclude node_module folder from build in visual studio 2015 update 3

I'm trying to use Visual Studio as my IDE for developing an ASP.NET MVC 5 SPA with Angular 2. The problem raises when I try to build the project. It gives me many errors inside *.d.ts files.

I created the project using angular-cli the command : ng new project-name

and here is what the solution explorer looks like :

as you see already I excluded the node_modules folder

How do I get rid of these errors? I haven't had any problems with using angular 2 in Visual Studio Code

error list panel

Update :

According to your answers I added the following in the tsconfig.json file, but it seems it doesn't work

{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "es2016"
    ]
  },
  "exclude": [
    "./node_modules",
    "**/*.spec.ts"
  ]
}
like image 735
Hooman Avatar asked Oct 18 '22 16:10

Hooman


2 Answers

Make sure you're using the latest Typescript tools for your version of Visual Studio. A colleague of mine had a similar problem, if you've already excluded the node_modules folder in your tsconfig this may be the issue.

For VS 2015: https://www.microsoft.com/en-us/download/details.aspx?id=48593

like image 61
Borquaye Avatar answered Oct 20 '22 21:10

Borquaye


{
    "compilerOptions": {
        "module": "system",
        "noImplicitAny": true,
        "removeComments": true,
        "preserveConstEnums": true,
        "outFile": "../../built/local/tsc.js",
        "sourceMap": true
    },
    "include": [
        "src/**/*"
    ],
    "exclude": [
        "node_modules",
        "**/*.spec.ts"
    ]
}
like image 28
El houcine bougarfaoui Avatar answered Oct 20 '22 22:10

El houcine bougarfaoui