Skip to content

deps: add deprecation warning for import assertion syntax

Not sure what the semverness of this would be, hopefully we can backport it to v18.x if https://github.com/nodejs/node/pull/51136 can land there. Here's what the warning looks like:

$ ./node --input-type=module -e 'import "./test/fixtures/empty.js" assert {}'
(node:94657) V8: file://…/[eval1]:1 'assert' is deprecated in import statements and support will be removed in 12.6; use 'with' instead
(Use `node --trace-warnings ...` to show where the warning was created)
$ ./node --input-type=module -e 'import "./test/fixtures/empty.js" with {}' 
$ ./node -e 'import("./test/fixtures/empty.js", { assert:{} })'               
(node:94696) V8: [eval]:1 'assert' is deprecated in import statements and support will be removed in 12.6; use 'with' instead
(Use `node --trace-warnings ...` to show where the warning was created)
$ ./node -e 'import("./test/fixtures/empty.js", { with:{} })'  

Should we mutate the V8 warning to say "in a future version" instead of "in 12.6"?

Refs: https://github.com/nodejs/node/issues/51622

Merge request reports

Loading