Open magnusriga opened 3 months ago
Sorry I'm focusing on https://github.com/un-es/eslint-plugin-import-x/issues/41 recently, so I don't have enough time to investigate in depth.
We're using enhanced-resolve
, if you can help to debug, that would be appreciated.
Got it @JounQin , but just quickly: Does the resolver not do file extension substitution, like TS does?
I believe it depends on enhanced-resolve
's algorithm first, I'm not sure whether it's controlled by us.
See also https://github.com/import-js/eslint-import-resolver-typescript/blob/master/src/index.ts#L39-L60
We have othe resolutions for path mapping at https://github.com/import-js/eslint-import-resolver-typescript/blob/9e24e10150f518710e1eb25271fa66f32913fe3e/src/index.ts#L306
@JounQin I looked into it and can confirm that it is indeed enhanced-resolver
that is responsible for # imports
and exports
, in the eslint-import-resolver-typescript
plugin. The code you added on top mainly tackles relative paths and the paths
field in tsconfig
, if I am not mistaken. I have posted a bug request here: https://github.com/webpack/enhanced-resolve/issues/413
Hi,
Thanks for a solid resolver. I am having an issue though, please see below.
According to the ts docs:
However, the below file and corresponding package.json (minimal repo here) throws this error:
File Excerpts
I am using
"typescript": "5.5.0-dev.20240314"
. Typescript finds the file, so it is only the import resolver that cannot find it.The error disappears if we change
.js
to.tsx
inpackage.json
, however that is not recommended practice. The TypeScript docs are very clear on the point that the package config should point to the output JS file(s), not the input TS files. Otherwise, the app might not work runtime, when consumed.Any idea what is going on?