6

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"
  ]
}

2 Answers 2

5

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"
  ]
}
Sign up to request clarification or add additional context in comments.

3 Comments

This worked! None of the other tutorials mentioned compileOnSave. I think it might be a bug in Visual Studio 2015 Update 2?
For me it compiled on save until I added a tsconfig.json file. Then it stopped working until I added compileOnSave.
For me it still doesn't work. I have posted my project here 1drv.ms/u/s!AvPiv6aM2fzRepKV9J_F0-387Zc can anybody please help me
-1

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

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.