Conflicts between files and folders with same name
- Dominant language
- JavaScript
- Stars
- 277
- Forks
- 86
- PR merge metrics
- No merged PRs in 30d
Description
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?
Contributor guide
No contributing guide indexed for this repository
Research direction
The issue names no repository files or tests. Start by locating the code that generates sibling file and directory exports, reproduce the Table.tsx/table collision, and compare the generated imports with the requested directory-safe behavior; done means the generated index avoids the casing conflict.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100