Skip to content

esm: add support for JSON import assertion

Import assertion support has landed behind a flag in V8 for quite some time, this PR enables it by default in Node.js. This PR allows folks to write JS code that uses import assertions syntax. Only type: “json” is supported for now, although JSON modules support in Node.js is still experimental and behind --experimental-json-modules CLI flag. This PR also disables importing of JSON modules without using an assertion, by popular demand. Support for those can be added using loader hooks.

Refs: https://github.com/nodejs/node/pull/37375#issuecomment-904732522 Alternative to https://github.com/nodejs/node/pull/39921

/cc @nodejs/modules @nodejs/loaders

Merge request reports

Loading