Skip to content

Import Attribute proposal syntax support has landed in V8 #50134

Closed
@nicolo-ribaudo

Description

What is the problem this feature will solve?

Node.js developers use import ... assert { ... } syntax, that might be removed in a future version.

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

Months ago, the import attributes proposal changed its keyword from assert to with. The assert keyword is still around because Chrome already shipped it, but we are actively working on removing it in the future.

The future of assert in Node.js was discussed in #46830, and there was wide support for re-flagging the old syntax. However, everybody forgot about it and nothing was done for the Node.js 20 release. Node.js 21 will be released next week, so there is a chance to do it now.

V8 now implements the with syntax, behind the --harmony-import-attributes flag. This syntax is already supported in other server-side environments, such as Deno and Bun.

The only reason with is still flagged in Chrome is because they are waiting for the full semantics to be there in the Chromium side, and whatwg/html#9486 still needs to be implemented. This HTML PR has minimal impact on Node.js (it only has impact when using HTTP imports), and it will be implemented by #50119.

I propose to unflag with in Node.js 21, and either:

  • re-flag assert, or
  • add a deprecation warning when assert is used, and re-flag it in 22

What alternatives have you considered?

Wait for the day Chrome will be done migrating, the syntax will be removed in V8 and there will be no action needed on the Node.js side to disable it :P

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions