Skip to content

Casing of output js and js.map files is not consistent. #2011

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
Vossekop opened this issue Feb 11, 2015 · 9 comments
Closed

Casing of output js and js.map files is not consistent. #2011

Vossekop opened this issue Feb 11, 2015 · 9 comments
Labels
Fixed A PR has been merged for this issue Help Wanted You can do this Suggestion An idea for TypeScript

Comments

@Vossekop
Copy link

It seems my initial assessment was incorrect (see a bit below what I originally thought happened). It turns out the output filename of a typescript file is not cased the same as the typescript file, but the same as the casing in the reference path another typescript. So if I have one file name CamelCased.ts and one called pascalCased.ts. And I put a reference to camelCased.ts in that last one, this will compile but the output js file will be named camelCased.js and not CamelCased.js as I would have expected.

I don't know if I would call this a bug, but it sure is inconvenient.

[Original]
In a visual studio project containing multiple ts files some start with a capital, and some are all lower case. After the TypeScriptCompile action is called for a file using only lower case, all subsequent file outputs are lower cased, even for ts files that start with a capital.

Files that start with a capital who are compiled before the first lower cased file all have outputs that start with a capital letter.

I know I should be more consistent in my naming, but if you ask me, it's a rather subtle way of forcing me....
[/Original]

@mhegazy mhegazy added the Suggestion An idea for TypeScript label Mar 24, 2015
@mhegazy
Copy link
Contributor

mhegazy commented Mar 24, 2015

The compiler currently issues an error of a file name is uses with inconsistent cases only on case sensitive systems. see getSourceFileFromCache.

A good change is to make this controlled by a flag, so that you get errors for inconsistent casing for file references, ensuring that the files are always generated in a consistent manner.

@jkristia
Copy link

I would consider this a bug. The compiler (in my opinion) should not be default change the file name casing. Even if I happened to name my file in a non standard way, the compiler should maintain the naming for the js file.
I just moved my project to Linux and was surprised of the many errors I got. It was only then I looked at the generated js files, and noticed the inconsistency in the generated file names

@mhegazy
Copy link
Contributor

mhegazy commented May 21, 2015

@jkristia the problem is getting the actual file name from disk can be expensive, and most of the users do not care about it. this is why the compiler uses the first name of the file it encounters to identify it, be it on the command line, ///reference or import. I would assume that you have some inconsistent casing for file references in your project (either build script or /// reference); would me earlier suggestion of adding a flag to ensure you really reference all files consistently not work for you?

@bleiddyn
Copy link

This issue caused me a few hours of confusion as well. If the file system check is expensive, perhaps we could add a fallback to case-insensitive when the compiler has trouble finding the file?

As an aid for people who have the same issue, the compiler error I was getting said, rather unhelpfully, "Module cannot be aliased to a non-module type."

@ghost
Copy link

ghost commented Jul 4, 2015

+1 million - One of our team members is having exactly the same problem and has been trying to fix this for the last hour with no luck.

@mhegazy mhegazy added the Help Wanted You can do this label Jul 6, 2015
@benliddicott
Copy link

Is a filesystem check actually that expensive? This has been profiled?
See also #3626
These sorts of issues seem trivial but occur regularly and cost hours of lost work to fix.

A few days ago I spent two hours chasing down package.config began with BOM - worked on my machine not on Azure. Two hours

@vladima
Copy link
Contributor

vladima commented Oct 27, 2015

#5275 introduces a flag forceConsistentCasingInFileNames - when it is set compiler will report an error if some file has multiple references with inconsistent casing inside the program

@vladima
Copy link
Contributor

vladima commented Oct 27, 2015

fixed in e811fec

@vladima vladima closed this as completed Oct 27, 2015
@vladima vladima added the Fixed A PR has been merged for this issue label Oct 27, 2015
@mhegazy
Copy link
Contributor

mhegazy commented Oct 27, 2015

The fix should be in typescippt@next tonight. Use the new --forceConsistentCasingInFileNames command line argument to make sure you are catching casing issues consistently.

@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Fixed A PR has been merged for this issue Help Wanted You can do this Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

6 participants