Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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"
  ]
}
like image 977
Derek Avatar asked Apr 08 '16 20:04

Derek


1 Answers

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"
  ]
}
like image 103
rgvassar Avatar answered Nov 15 '22 04:11

rgvassar