Derek
Derek

Reputation: 5855

Angular 2 .ts file not transpiling to .js on save in Visual Studio 2015 ASP.NET Core project

If I make a change to app.component.ts and save the file, the change won't appear in app.component.js until I build the project manually.

My goal is to have Angular 2 code changes reflected in the browser after I save. I shouldn't have to do a build every time.

Here is my tsconfig.json:

{
  "compilerOptions": {
    "target": "es5",
    "module": "system",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  },
  "exclude": [
    "node_modules",
    "typings/main",
    "typings/main.d.ts"
  ]
}

Upvotes: 6

Views: 3518

Answers (2)

user3453153
user3453153

Reputation: 1

on Task Runner Explorer go to Custom and run tsc:w

Upvotes: -1

rgvassar
rgvassar

Reputation: 5811

You're missing "compileOnSave": true. The TypeScript documentation says it only works with Visual Studio 2015 and with the Atom TypeScript plugin. It also requires TypeScript 1.8.4 or higher.

{
  "compileOnSave": true,
  "compilerOptions": {
    "target": "es5",
    "module": "system",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  },
  "exclude": [
    "node_modules",
    "typings/main",
    "typings/main.d.ts"
  ]
}

Upvotes: 5

Related Questions