-
Notifications
You must be signed in to change notification settings - Fork 27
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
Crash when using import-in-the-middle
with module.exports = {...require('$dependency')}
#157
Comments
This doesn't look like a crash. It's a logged error telling you a module could not be wrapped. |
Thanks for the quick response! no test is run though, meaning
vs without the loader:
|
hey @timfish do you need more information? I can also try to debug it myself if you can give me some pointers 😄 |
I've not had a chance to look yet but my guess is that this is something to do with the parser.. although the parser should only be used for ESM. |
where's this logic in the code? I'm debugging the issue but AFAICT the parsing happens for every file |
Please make the minimal reproduction a single script. |
The smallest repro case I could create is in https://github.com/juan-fernandez/iitm-issue-repro The error is different 🤔, but I think they might be related somehow, and it does look like a bug. Let me know if you have questions 😄 |
I am unable to assist. I don't know what |
that's defined in https://github.com/juan-fernandez/iitm-issue-repro/blob/main/package.json#L19-L23 it's a package internal import mimicking the original issue: https://nodejs.org/api/packages.html#imports |
Expected Behavior
Using a
myloader.mjs
file like thisand using
NODE_OPTIONS='--import ./myloader.mjs' $my_command
does not crash.Actual Behavior
Running
results in
Steps to Reproduce the Problem
starter-kit
fork:--import
flag:See this error:
Specifications
Running
npx envinfo
Investigation
If you look at
node_modules/@prisma/client/default.js
the file looks like this:Funnily enough, if you change the file contents to this:
the crash does not happen anymore.
Context
DataDog/dd-trace-js#4713
Extra repro case
https://github.com/juan-fernandez/iitm-issue-repro is lighter. It does not throw the same exact error but seems to be caused with a very similar setup, so it's likely to be related
The text was updated successfully, but these errors were encountered: