Skip to content

Problem with "File name ... differs from already included file name ... only in casing" #50569

Closed
@akphi

Description

@akphi

Bug Report

🔎 Search Terms

File differs from already included file only in casing, only in casing, File differs

🕗 Version & Regression Information

This changed between version 4.7.4 and 4.8.2. I tested with 4.8.1-rc and it still works fine, so maybe something happened in 4.8.2

💻 Code

This is my repro branch
akphi/issue-repo#9

If I have to speculate, the particular thing about my setup is I use module: NodeNext and forceConsistentCasingInFileNames: true and in src folder, I have 2 files: (1) imports something from a library package (e.g. serializr) and (2) imports something from a package that has serializr as a dependency) (note that I already tested with other packages to make sure it doesn't only happen toserilizr).
(2) imports from @finos/legend-shared, a package that ships ESM code. Really sorry about this complexity in the setup, I have tried my best to reduce the size of the repro 🙏. But this is crucial for our setup: basically, we have a codebase that publishes @finos/legend-shared - an utility only library and consume that in another codebase, hence when I bump into this error

To reproduce the issue, run the following:

npm install && npm run dev:ts

🙁 Actual behavior

I got the error

src/index.ts:1:27 - error TS1149: File name '/Users/my-user/Developer/js/issue-repo/node_modules/serializr/lib/serializr.d.ts' differs from already included file name '/users/my-user/developer/js/issue-repo/node_modules/serializr/lib/serializr.d.ts' only in casing.
  The file is in the program because:
    Imported via 'serializr' from file '/users/my-user/developer/js/issue-repo/node_modules/@finos/legend-shared/lib/application/SerializationUtils.d.ts' with packageId 'serializr/lib/[email protected]'
    Imported via "./serializr" from file '/users/my-user/developer/js/issue-repo/node_modules/serializr/lib/constants.d.ts' with packageId 'serializr/lib/[email protected]'
    Imported via "serializr" from file '/Users/my-user/Developer/js/issue-repo/src/index.ts' with packageId 'serializr/lib/[email protected]'
  File is CommonJS module because '/users/my-user/developer/js/issue-repo/node_modules/serializr/package.json' does not have field "type"

1 import { serialize } from "serializr";
                            ~~~~~~~~~~~

As you can see in my src/index.ts file

import { serialize } from "serializr";
export { default as hashObject } from "object-hash";
import { cloneDeep } from "lodash-es";

This also fails for object-hash and lodash-es.

🙂 Expected behavior

This should compile fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions