-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
compat: imported scripts are always handled as ESM #12648
Comments
I can look into that next week |
@kt3k how burning of a need is this issue? I did some exploratory work and it seems harder than I expected to fix this problem. |
4 sub test catetories are blocked by this in the mocha compatibility work. So this is very much needed, but there are some more independent issues to work on. So my work is not particularly blocked by this one |
I did some research on what is the problem here - basically we don't currently have a notion of "translators" which are integral parts of Node's ESM loader. "translators" are used to transform source code of modules to compatible formats; in this case The hard part in our case is that we got ESM loader in CLI and CJS loader in |
So it seems that the main integration point would have to be I'm not yet sure how to tackle this without wreaking havoc in current module loading logic to handle compat mode everywhere but it appears that rewrite of |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
Suppose we have following scripts:
main.mjs
imported.js
If we run this with node, it simply prints
{}
:But if we run this with deno-compat mode, then it throws like the below:
The difference here is that node handles
imported.js
as CJS, but deno compat handles it as ESM.Side note: This prevents deno-compat passing
test/interfaces/exports.spec
test case inmocha
repository. related: #12577The text was updated successfully, but these errors were encountered: