@@ -409,18 +409,11 @@ fs.readFileSync = () => Buffer.from('Hello, ESM');
409409fs .readFileSync === readFileSync;
410410` ` `
411411
412- ## Experimental JSON Modules
412+ ## JSON Modules
413413
414- **Note: This API is still being designed and is subject to change.**
414+ JSON modules follow the [WHATWG JSON modules specification][].
415415
416- Currently importing JSON modules are only supported in the ` commonjs` mode
417- and are loaded using the CJS loader. [WHATWG JSON modules][] are currently
418- being standardized, and are experimentally supported by including the
419- additional flag ` -- experimental- json- modules` when running Node.js.
420-
421- When the ` -- experimental- json- modules` flag is included both the
422- ` commonjs` and ` module ` mode will use the new experimental JSON
423- loader. The imported JSON only exposes a ` default` , there is no
416+ The imported JSON only exposes a ` default` . There is no
424417support for named exports. A cache entry is created in the CommonJS
425418cache, to avoid duplication. The same object will be returned in
426419CommonJS if the JSON module has already been imported from the
@@ -433,14 +426,6 @@ Assuming an `index.mjs` with
433426import packageConfig from ' ./package.json' ;
434427` ` `
435428
436- The ` -- experimental- json- modules` flag is needed for the module
437- to work.
438-
439- ` ` ` bash
440- node -- experimental- modules index .mjs # fails
441- node -- experimental- modules -- experimental- json- modules index .mjs # works
442- ` ` `
443-
444429## Experimental Wasm Modules
445430
446431Importing Web Assembly modules is supported under the
@@ -763,7 +748,7 @@ success!
763748[CommonJS]: modules.html
764749[ECMAScript-modules implementation]: https://github.com/nodejs/modules/blob/master/doc/plan-for-new-modules-implementation.md
765750[Node.js EP for ES Modules]: https://github.com/nodejs/node-eps/blob/master/002-es-modules.md
766- [WHATWG JSON modules]: https://github.com/ whatwg/html/issues/4315
751+ [WHATWG JSON modules specification ]: https://html.spec. whatwg.org/#creating-a-json-module-script
767752[ES Module Integration Proposal for Web Assembly]: https://github.com/webassembly/esm-integration
768753[dynamic instantiate hook]: #esm_dynamic_instantiate_hook
769754[the official standard format]: https://tc39.github.io/ecma262/#sec-modules
0 commit comments