Skip to content

Compile-on-build conflicting with Compile-on-save #5424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jeradrose opened this issue Oct 27, 2015 · 6 comments
Closed

Compile-on-build conflicting with Compile-on-save #5424

jeradrose opened this issue Oct 27, 2015 · 6 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue Visual Studio Integration with Visual Studio

Comments

@jeradrose
Copy link

It seems that when Visual Studio compiles TS into JS, there are some inconsistencies, resulting in a ping-pong match with commits. Specifically, when compiling from a solution build, the yielded .js is different from the .js resulting from compiling from a save.

For one (simple) example, compile-on-save will use enums:

_this.kernelState(NotebookKernelState.Queued);

Where compile-on-build will use constants w/ comments:

_this.kernelState(5 /* TimeExpired */);

Another example is how they vary their formats (this may be related to ReSharper settings, though not sure how to make these sync between build compiles and save compiles):

Compile-on-save:

catch (e) { }

Compile-on-build:

catch (e) {
}

I'll also see the sourceMappingUrl comment get removed with compile-on-save:

//# sourceMappingURL=myfile.js.map

Then get added back on with compile-on-build.

Is this a bug, or is it something that we may have misconfigured somewhere?

@mhegazy
Copy link
Contributor

mhegazy commented Oct 27, 2015

Which version of TS and VS are you using? and can you share a repro project?

@mhegazy mhegazy added the Needs More Info The issue still hasn't been fully clarified label Oct 27, 2015
@jeradrose
Copy link
Author

I'm using Visual Studio 2015 (build 23107) and TypeScript 1.6.3.

The attached project (add .zip) can repro the .map comment and the enum. Note that the enum difference only appears when targeting 1.4 -- targeting 1.6 makes these consistent between save and build compiles. But the .map comment is there in 1.4 and 1.6.

I couldn't repro the formatting difference in this project (yet), so I'm thinking that has something to do with project-level ReSharper settings. If I can get this to repro, I'll let you know.

reprotypescriptcompile zip

@mhegazy
Copy link
Contributor

mhegazy commented Oct 28, 2015

Thanks for the repro. the first issue has been fixed in TS 1.5 (see #1812). the formatting issue is strange, have not seen this before. as for the last issue, looks like this project file does not have any configuration options. adding config options, either manually by unloading the project or by saving from the project property pages solves the issue:

  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
    <TypeScriptSourceMap>True</TypeScriptSourceMap>
  </PropertyGroup>

how was this project created? is that from template? or hand authored?

@jeradrose
Copy link
Author

It was created using VS empty web project template.

I will try the source map config to see if that fixes that issue.

@mhegazy mhegazy added the Bug A bug in TypeScript label Oct 28, 2015
@mhegazy mhegazy removed the Needs More Info The issue still hasn't been fully clarified label Oct 28, 2015
@mhegazy
Copy link
Contributor

mhegazy commented Oct 28, 2015

looks like we are not loading the property correctly. @paulvanbrenk can you take a look. i see the source map checkbox checked correctly in the project property pages but not passed correctly to the compiler..

@mhegazy mhegazy added this to the TypeScript 1.8 milestone Dec 8, 2015
@mhegazy mhegazy added the Visual Studio Integration with Visual Studio label Jan 27, 2016
@paulvanbrenk
Copy link
Contributor

This looks like it's fixed in 1.8

@paulvanbrenk paulvanbrenk added the Fixed A PR has been merged for this issue label Feb 16, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue Visual Studio Integration with Visual Studio
Projects
None yet
Development

No branches or pull requests

3 participants