-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fails to resolve exports
defined submodule when reexported by another package
#63
Comments
When |
Similar issue trying to import langchain:
The line in question:
Seems like if it's an external package, this logic won't work either. Could this be used instead? https://nodejs.org/api/esm.html#importmetaresolvespecifier Edit: oh, I see you can't do that because import-in-the-middle isn't type module. I tried adding require resolution here and it sorta worked, but I got another issue with a duplicate identifier.
Oh, looks like someone had the exact same thought process: #60. Looks like #59 could be a dupe. |
#62 is also potentially a dupe (with repro), displaying the same issue of re-exports of another module being incorrectly treated as subdirectories/files within the module doing the re-export. |
Not able to reproduce this issue, can you confirm the IITM version you are using? |
I was able to reproduce the issue on master, looking into it |
@khanayan123 Is there any update? I'd like to help if there are some failed tests can be investigated. |
I've been looking into this with the following reliable reproduction using Node v22.2.0: import { register } from 'node:module';
register('import-in-the-middle/hook.mjs', import.meta.url);
await import ('@discordjs/builders'); Which results in:
It appears that this code expects the module it's loading to be relative to the current file: My proposal is that if it's a bare specifier, we call I'll attempt a PR! |
This should have been resolved by #78 |
node_modules/has-submodule/package.json
node_modules/has-submodule/sub.js
node_modules/reexport-submodule/package.json
node_modules/reexport-submodule/index.js
load-sub.mjs
esm-loader.mjs
Expected Behavior
Actual Behavior
Steps to Reproduce the Problem
Shown above.
The text was updated successfully, but these errors were encountered: