`scanImportsFromDir` fails to detect `subdir/index.{tsx|jsx}` files
Opened this issue · 0 comments
aklinker1 commented
Environment
- Unimport:
v3.7.1
- Node:
v18.16.1
Reproduction
https://github.com/aklinker1/unimport-tsx-bug
pnpm i
node index.mjs
Describe the bug
When components/index.ts
exports a subdirectory with a index.tsx
file in it, an error is throw (see logs below).
Same error is thrown if the file is components/Iframe/index.jsx
.
There is a work-around, change the export in components/index.ts
:
-export * from "./Iframe";
+export * from "./Iframe/index.tsx";
Additional context
This issue originates from: wxt-dev/wxt#440
I did some research into this and it appears we just need to add "tsx"
and "jsx"
to the file extensions array?
Lines 41 to 48 in 8a622c9
#229 fixed this for non-JSX files.
Logs
$ node index.mjs
node:internal/process/esm_loader:97
internalBinding('errors').triggerUncaughtException(
^
[Error: EISDIR: illegal operation on a directory, read] {
errno: -21,
code: 'EISDIR',
syscall: 'read'
}
Node.js v18.16.1