Skip to content

[v18.x backport] Backport import attributes syntax to v18 #51118

Closed
@nicolo-ribaudo

Description

@nicolo-ribaudo

What is the problem this feature will solve?

When using import attributes, users have two choices:

  • import "foo" with { ... } is the final syntax that will be included in the language, but it's only supported on Node.js 20+
  • import "foo" assert { ... } is supported in all LTS Node.js versions, but will likely be removed from the proposal one day

Node.js 18 is supported until April 2025, so this situation will not "solve by itself" for one year and a half.

What is the feature you are proposing to solve the problem?

I'd like to backport the with syntax to Node.js 18. Specifically, this patch: https://chromium-review.googlesource.com/c/v8/v8/+/4705558 (minus the use-counter changes, since they are only useful in Chrome). I'm willing to open a PR for it, but I would need some pointer on how to backport V8 features.

Note that some of the import attribute changes have already been backported to Node.js 18 (#50669). Specifically, the API changes exposed to ESM loaders.

With this extra backport, all maintained LTS versions would have the same degree of support for import attributes.

What alternatives have you considered?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.v18.xIssues that can be reproduced on v18.x or PRs targeting the v18.x-staging branch.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions