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?
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 casingFor example:
This will generate an
index.jsthat looks like: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.jsto the directory import fixes this issue.In fact, a better option would be to use wildcards and to omit extension all together like this:
Can this please be added?