Skip to content
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

Referring to the same file with different casing causes empty output #122

Closed
LPGhatguy opened this issue Mar 28, 2016 · 4 comments
Closed
Labels

Comments

@LPGhatguy
Copy link
Contributor

I have an app that's roughly structured like this:

app
+-- main.ts
+-- Game
    +-- Core.ts
+-- Net
    +-- index.ts

main.ts referenced Game/Core.ts with the name app/Game/Core (correct), while Net/index.ts referenced it with app/game/Core (incorrect).

The result is that the output bundle is empty, with no errors or warnings reported. Fixing the casing to be correct in all cases fixes the issue, but an error would be nice.

This is on Windows 10, with tsify 0.14.1, Browserify 13.0.0, and TypeScript 1.8.9.

@LPGhatguy LPGhatguy changed the title Referring to the same file with different case causes empty output Referring to the same file with different casing causes empty output Mar 28, 2016
@smrq
Copy link
Member

smrq commented Apr 4, 2016

What a bummer. I see why that happens...

Not sure what the appropriate fix is, necessarily. The problem is that since Windows is case-insensitive and pretty much everything else Linux is case-sensitive, fixing this on Windows will break everywhere else Linux. It could be platform-dependent behavior, I guess, but platform-dependent switches kind of suck for maintainability...

Obviously, "don't do that" (relying on case-insensitivity means you've made your project impossible to build on other platforms for no good reason) -- but error messages are kind of necessary to even diagnose the issue.

@smrq smrq added the bug label Apr 4, 2016
@LPGhatguy
Copy link
Contributor Author

For reference, I actually first encountered this bug on OS X, which is also case-insensitive!

TypeScript seems to have gained a new option involving referencing files with different casing throwing errors. Does this problem happen at the TypeScript level or elsewhere?

If it's elsewhere, it might be possible to half-way fix the problem by detecting a case-sensitive filesystem and normalizing all paths down. I didn't see any ways to detect something like that out-of-the-box in Node.js, but there are some obvious ideas with some potential for false-positives.

@smrq
Copy link
Member

smrq commented Apr 4, 2016

TIL that OSX is case-insensitive too! (As I'm typing this on OSX, no less...)

My assumption is that the error happens at the level of the in-memory file store, which is keyed on (case-sensitive) filename. There might be a way of using the TS compiler's mechanism for detecting the problem, though... would be worth looking into.

@cartant
Copy link
Contributor

cartant commented Aug 7, 2016

This should be closed by #171. However, the changes in that PR weren't made to resolve this issue; its resolution is a side-effect. With said changes, the output bundle should contain what you'd expect. (However, that might not be the end of your problems, as I noticed that there were errors with paths in the source maps if there were mismatches in case. Probably best to ensure the case is correct, but I don't think it's up to tsify to check/enforce that.)

@cartant cartant closed this as completed Aug 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants