@@ -476,22 +476,6 @@ These CommonJS variables are not available in ES modules.
476476` __filename` and ` __dirname` use cases can be replicated via
477477[` import.meta.url` ][].
478478
479- #### No JSON Module Loading
480-
481- JSON imports are still experimental and only supported via the
482- ` --experimental-json-modules` flag.
483-
484- Local JSON files can be loaded relative to ` import.meta.url` with ` fs` directly:
485-
486- <!-- eslint-skip -->
487-
488- ` ` ` js
489- import { readFile } from ' fs/promises' ;
490- const json = JSON .parse (await readFile (new URL (' ./dat.json' , import .meta.url)));
491- ` ` `
492-
493- Alternatively ` module .createRequire ()` can be used.
494-
495479#### No Native Module Loading
496480
497481Native modules are not currently supported with ES module imports.
@@ -529,35 +513,19 @@ separate cache.
529513
530514> Stability: 1 - Experimental
531515
532- Currently importing JSON modules are only supported in the ` commonjs` mode
533- and are loaded using the CJS loader. [WHATWG JSON modules specification][] are
534- still being standardized, and are experimentally supported by including the
535- additional flag ` --experimental-json-modules` when running Node.js.
536-
537- When the ` --experimental-json-modules` flag is included, both the
538- ` commonjs` and ` module` mode use the new experimental JSON
539- loader. The imported JSON only exposes a ` default ` . There is no
540- support for named exports. A cache entry is created in the CommonJS
541- cache to avoid duplication. The same object is returned in
542- CommonJS if the JSON module has already been imported from the
543- same path.
544-
545- Assuming an ` index.mjs` with
516+ JSON files can be referenced by ` import` :
546517
547518` ` ` js
548519import packageConfig from ' ./package.json' assert { type : 'json ' };
549520` ` `
550521
551- The ` -- experimental- json- modules` flag is needed for the module
552- to work.
553-
554- ` ` ` bash
555- node index .mjs # fails
556- node -- experimental- json- modules index .mjs # works
557- ` ` `
558-
559522The ` assert { type: ' json' }` syntax is mandatory; see [Import Assertions][].
560523
524+ The imported JSON only exposes a ` default` export. There is no support for named
525+ exports. A cache entry is created in the CommonJS cache to avoid duplication.
526+ The same object is returned in CommonJS if the JSON module has already been
527+ imported from the same path.
528+
561529<i id="esm_experimental_wasm_modules"></i>
562530
563531## Wasm modules
@@ -1451,7 +1419,6 @@ success!
14511419[Node.js Module Resolution Algorithm]: #resolver-algorithm-specification
14521420[Terminology]: #terminology
14531421[URL]: https:// url.spec.whatwg.org/
1454- [WHATWG JSON modules specification]: https:// html.spec.whatwg.org/#creating-a-json-module-script
14551422[`"exports"`]: packages.md#exports
14561423[`"type"`]: packages.md#type
14571424[`--input-type`]: cli.md#--input-typetype
0 commit comments