You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How often does it reproduce? Is there a required condition?
This happens consistently, curiously the features seem to work separately but not together:
// Both of these are fine:
> let p = import("./package.json", { assert: { type: "json" } });
> let p = await import("./package.json"); // Runtime error due to missing second arg
What is the expected behavior? Why is that the expected behavior?
This should parse as it is perfectly valid syntax (and it works without await).
There was recently changes to the import assertions proposal to change assert to with (along with changes to affect runtime), but even with that the parsing of the above would be the same anyway.
The text was updated successfully, but these errors were encountered:
It's not valid syntax according to the current ES spec – because the Import Attributes proposal is stage 3 only.
it works without await
The reason for this lack of consistency is because when you pass a string that contains await, it goes through Acorn, and I think Acorn only supports stage 4 syntax.
Not sure what to do about that, I guess if you are using await on the REPL, you have to accept Acorn limitations, I don't think there's a way around that.
You are correct. I tested dynamic imports with attributes on Node.js 23.3.0, and everything works as expected. I suggest closing this issue. Thank you for your cooperation.
Version
v19.8.1
Platform
Linux 5.19.0-38-generic #39~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 17 21:16:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
repl
What steps will reproduce the bug?
Try in the repl:
How often does it reproduce? Is there a required condition?
This happens consistently, curiously the features seem to work separately but not together:
What is the expected behavior? Why is that the expected behavior?
This should parse as it is perfectly valid syntax (and it works without
await
).What do you see instead?
The error:
Additional information
There was recently changes to the import assertions proposal to change
assert
towith
(along with changes to affect runtime), but even with that the parsing of the above would be the same anyway.The text was updated successfully, but these errors were encountered: