Skip to content
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

Add dynamic import attributes #1332

Closed
029A-h opened this issue Dec 5, 2024 · 3 comments
Closed

Add dynamic import attributes #1332

029A-h opened this issue Dec 5, 2024 · 3 comments

Comments

@029A-h
Copy link

029A-h commented Dec 5, 2024

According to this: tc39/ecma262#3057 (comment) we are, or very soon will be, at stage 4 with dynamic import attributes.

Dynamic import attributes are still in pending status due to stage 3 (#1111).

Can we now include this feature in Acorn as well?

Motivation
The Node REPL does not support direct dynamic import with await.

> await import('/tmp/data.json', { with: { type: 'json' } });
Uncaught SyntaxError: 
await import('/tmp/data.json', { with: { type: 'json' } })
                                                 ^

Unexpected token ','

This unwanted behavior is caused by Acorn's lack of support for dynamic import attributes (nodejs/node#47463).

@marijnh
Copy link
Member

marijnh commented Dec 5, 2024

You can prepare a pull request, but we don't merge features until they hit stage 4.

@ota-meshi
Copy link
Contributor

I believe Acorn already supports dynamic import attributes.

'import("foo.json", { with: { type: "json" } });',

@marijnh
Copy link
Member

marijnh commented Dec 6, 2024

Oh, indeed, they are actually already in acorn 8.14.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants