Skip to content

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

Closed

Description

@LPGhatguy

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.

Activity

  1. 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[/+] on Mar 28, 2016
  2. smrq commented on Apr 4, 2016

    @smrq
    Member

    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.

  3. LPGhatguy commented on Apr 4, 2016

    @LPGhatguy
    ContributorAuthor

    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.

  4. smrq commented on Apr 4, 2016

    @smrq
    Member

    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.

  5. cartant commented on Aug 7, 2016

    @cartant
    Contributor

    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.)

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ Proxy