Skip to content

Compile on Build / Compile on Save problems with TS 1.8 in Visual Studio 2015 #6782

Closed

Description

Since I installed TS 1.8 I've started noticing that the compile step is not being executed in Visual Studio either on save or upon build when there are existing *.js files in place.

So if I'm working on viewModel.ts then I need to delete viewModel.js and trigger a Visual Studio build in order that a new viewModel.js is created.

My tsconfig.json looks like this:

{
  "compileOnSave": false,
  "compilerOptions": {
    "inlineSourceMap": true,
    "inlineSources": true,
    "noEmitOnError": true,
    "noImplicitAny": true,
    "preserveConstEnums": true,
    "removeComments": false,
    "sourceMap": false,
    "target": "es5"
  },
  "filesGlob": [
    "**/*.ts"
  ],
  "files": [
    // lots of files here - excluded for brevity
  ],
  "atom": {
    "rewriteTsconfig": true
  }
}

I wondered if it might be related to presence of the compileOnSave flag in tsconfig.json (which I believe is supported as of TS 1.8?). However setting it to true and removing it entirely made no discernible differerence to behaviour. (I tried closing and reopening the project in between changes in case there were caching issues but no change.)

So compileOnSave seems entirely broken (i.e. it never compiles on save) and compile on build only works if the existing js files are deleted.

Activity

  1. mhegazy commented on Feb 2, 2016

    @mhegazy
    Contributor

    the compileOnSave property support is not in a released version yet, Paul van Brenk (@paulvanbrenk) checked it in today :). it should be available for the 1.8.2.

    Can you check your tools\options\Text Editor\TypeScript\Project\Compile on Save, do you have "Automatically compile TypeScript files that are not part of a project" checked? my guess is no, and that is why it is not working. with #2326, you should be able to turn it on using compileOnSave property in tsconfig.json.

  2. johnnyreilly commented on Feb 2, 2016

    @johnnyreilly
    Author

    Yup that solved it. Thanks @mhegazy.I'll look out for compileOnSave lighting up in when 1.8.2 ships.

  3. added
    ExternalRelates to another program, environment, or user action which we cannot control.
    and removed
    Needs More InfoThe issue still hasn't been fully clarified
    on Feb 2, 2016
  4. johnnyreilly commented on Feb 16, 2016

    @johnnyreilly
    Author

    Mohamed Hegazy (@mhegazy) - I'm guessing with the VS 2015 TypeScript 1.8 beta plugin I shouldn't expect compileOnSave to be working? I've noticed whilst using Visual Studio that saving is still generating the js files still (even though the flag is set in tsconfig.json).

    I wanted to ask about building as well but I'll break that out into a separte issue.

  5. paulvanbrenk commented on Feb 16, 2016

    @paulvanbrenk
    Contributor

    John Reilly (@johnnyreilly) Indeed, the compileOnSave option needs new Visual Studio bits.

  6. johnnyreilly commented on Feb 16, 2016

    @johnnyreilly
    Author
  7. mythz commented on Feb 23, 2016

    @mythz

    Is tsconfig.json and compileOnSave expected to work on VS 2013? I've installed the latest v1.8.2 of TypeScript for VS2013 and it's missing the "TypeScript JSON Configuration File" new item template for tsconfig.json, adding it manually doesn't disable the TypeScript property page on project properties and none of the configuration on tsconfig.json seems to be overriding either?

  8. mhegazy commented on Feb 23, 2016

    @mhegazy
    Contributor

    Demis Bellot (@mythz), tsconfig.json is not supported for Visual Studio 2013. only Visual Studio 2015.

  9. codler commented on Feb 29, 2016

    @codler

    Seems compileOnSave are not executing same path as VS project root, because out is generating on different path when i do build respective save

  10. mhegazy commented on Feb 29, 2016

    @mhegazy
    Contributor

    Han Lin Yap (@codler) can you share your project?

  11. paulvanbrenk commented on Feb 29, 2016

    @paulvanbrenk
    Contributor

    Han Lin Yap (@codler) which version of TypeScript? We've fixed issues in that area.

  12. hcapp01 commented on Mar 17, 2016

    @hcapp01

    Paul van Brenk (@paulvanbrenk) I can repro colder's issue on 1.8.4.0.

  13. 11 remaining items

  14. mhegazy commented on May 13, 2016

    @mhegazy
    Contributor

    Mike Graham (@cmichaelgraham) do you mind filing another issue for this?

  15. mhegazy commented on May 13, 2016

    @mhegazy
    Contributor

    and hello Mike Graham (@cmichaelgraham), good to see you!

  16. paulvanbrenk commented on May 13, 2016

    @paulvanbrenk
    Contributor

    Not sure, are the other settings in the tsconfig.json picked up?

  17. Methodician commented on Jun 24, 2016

    @Methodician

    Here's what I don't get: it sometimes works fine and others it doesn't!

    I can't for the life of me figure out what I'm doing right or wrong when, or if I even have any influence on this at all. It's almost more frustrating to have it work "sometimes" than to just never work.

    My workaround sucks. Today, it simply doesn't work so I am back to the habit of hitting "Rebuild" every time I make the tiniest change. Please tell me you've found a better temporary workflow/workaround until this is fixed!!!

    But yesterday it was all unicorns and rainbows. Everything was flowing beautifully in the same solution, same IDE, same computer. No idea what changed. If it works sometimes, maybe there's a tweak to get it to work always?

  18. Methodician commented on Jun 24, 2016

    @Methodician

    Please share your workarounds

    I guess this problem has been around for a while now and like me, if you're still pushing through you must have come up with a pattern, habit, workflow, or workaround that is getting you through each day until this is fixed. Mine is to "rebuild" the whole solution every time I make the tiniest change to any .ts file. Surely someone has come up with a better way. Please do tell!

  19. paulvanbrenk commented on Jun 24, 2016

    @paulvanbrenk
    Contributor

    We found an issue with compile on save and tsconfig.json files, that depended on the order we processed files, which is not always the same. This fix is part of VS 2015 Update 3 [0].

    [0] I can't tell you when that will be released, but the RC release has other TypeScript issues, so don't install that.

  20. Methodician commented on Jun 25, 2016

    @Methodician

    I installed the Update 3 RC and it has helped with a lot of other problems but not this one. Most vitally, it made the .tfignore file work, which I absolutely need when committing lots of small typescript files to source control and wanting to ignore the transpiled .js and .map.js files.

    Paul van Brenk (@paulvanbrenk) could you maybe provide a little more detail on the "order we processed files" as I'd like to tinker but honestly don't know what you're talking about.

  21. gleno commented on Jul 5, 2016

    @gleno

    I have very similar issues. Everything compiles correctly, but it takes a very long time, and sometimes randomly flakes out. Wasn't like this with the previous version of TSC.

  22. mhegazy commented on Jul 5, 2016

    @mhegazy
    Contributor

    gleno this is an old issue. do you mind filing a new issue, sharing more details about what you are seeing, what version of VS you are using what version of TS, and a project to help investigate the issue.

  23. mikelunn commented on Jul 28, 2016

    @mikelunn

    I'm using VS 2015 Update 3 and are experiencing a very similar issue. The typescript compiler seems to only work when I do a build. However, if I do a build, and no server side code has changed, the typescript code will not compile.

  24. gleno commented on Jul 28, 2016

    @gleno

    I've recovered my problem by installing an older version of node tools. If
    you have just updated, this may be your issue.
    On Thu, 28 Jul 2016 at 23:42, Mike Lunn notifications@github.com wrote:

    I'm using VS 2015 Update 3 and are experiencing a very similar issue. The
    typescript compiler seems to only work when I do a build. However, if I do
    a build, and no server side code has changed, the typescript code will not
    compile.

    —
    You are receiving this because you were mentioned.
    Reply to this email directly, view it on GitHub
    #6782 (comment),
    or mute the thread
    https://github.com/notifications/unsubscribe-auth/AC1DQsox5RL6iYUR4I_LRzfPGrqVoMaBks5qaRRLgaJpZM4HQq5h
    .

  25. paulvanbrenk commented on Jul 29, 2016

    @paulvanbrenk
    Contributor

    Mike Lunn (@mikelunn) As Mohamed mentioned this is a very old issue, can you file a new issue with a sample project. And diagnostic build logs. Thanks

  26. dudih commented on Aug 18, 2016

    @dudih

    I had the same problem in my visual studio update 3.
    It's seems that widows didn't get my typescript 1.8 version, but hold the 1.0 version. so I changed it manually. Now it's work. on saving a .ts file, all my project being transpiled correctly.

    For more info: http://stackoverflow.com/questions/39021808/vs2015-adding-watch-true-to-tsconfig-json-causing-jserrorscriptexception-0x/39022452#39022452

  27. ybarbaria commented on Oct 20, 2016

    @ybarbaria

    In typescript 2, you need to delete "outDir" in your tsconfig. Works for me.

  28. locked and limited conversation to collaborators on Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExternalRelates to another program, environment, or user action which we cannot control.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions