Skip to content

Conflicts between files and folders with same name #65

Description

@crazyjat

I'm using React 18 and Typescript 4.7.4

I have a file named Table.tsx and a directory named table in the same directory. The generated index.js will cause an error differs from already included file name ... only in casing

For example:

├── src
    ├─ components
       ├─ Table.tsx
       ├─ table
          ├─ TableSidebar.tsx
          ├─ TableProps.ts

This will generate an index.js that looks like:

export { default as Table } from './Table.tsx';
export { default as table } from './table';

This will produce the following error:
File name 'C:/dev/src/components/Table.tsx' differs from already included file name 'C:/dev/src/components/table' only in casing.

This is due to the fact that the loader automatically "assumes" an extension if a file by that name exists. Adding index.js to the directory import fixes this issue.

export { default as Table } from './Table.tsx';
export { default as table } from './table/index.js';

In fact, a better option would be to use wildcards and to omit extension all together like this:

export * from './Table';
export * from './table/';

Can this please be added?

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions