File tree Expand file tree Collapse file tree 3 files changed +2
-19
lines changed Expand file tree Collapse file tree 3 files changed +2
-19
lines changed Original file line number Diff line number Diff line change @@ -296,7 +296,7 @@ Enable experimental `import.meta.resolve()` support.
296
296
added: v12.9.0
297
297
-->
298
298
299
- Enable experimental JSON support for the ES Module loader .
299
+ This option is a no-op. It is kept for compatibility .
300
300
301
301
### ` --experimental-loader=module `
302
302
Original file line number Diff line number Diff line change @@ -477,22 +477,6 @@ These CommonJS variables are not available in ES modules.
477
477
` __filename` and ` __dirname` use cases can be replicated via
478
478
[` import.meta.url` ][].
479
479
480
- #### No JSON Module Loading
481
-
482
- JSON imports are still experimental and only supported via the
483
- ` --experimental-json-modules` flag.
484
-
485
- Local JSON files can be loaded relative to ` import.meta.url` with ` fs` directly:
486
-
487
- <!-- eslint-skip -->
488
-
489
- ` ` ` js
490
- import { readFile } from ' fs/promises' ;
491
- const json = JSON .parse (await readFile (new URL (' ./dat.json' , import .meta.url)));
492
- ` ` `
493
-
494
- Alternatively ` module .createRequire ()` can be used.
495
-
496
480
#### No Native Module Loading
497
481
498
482
Native modules are not currently supported with ES module imports.
@@ -538,7 +522,7 @@ import packageConfig from './package.json' assert { type: 'json' };
538
522
539
523
The ` assert { type: ' json' }` syntax is mandatory; see [Import Assertions][].
540
524
541
- The imported JSON only exposes a ` default` . There is no support for named
525
+ The imported JSON only exposes a ` default` export . There is no support for named
542
526
exports. A cache entry is created in the CommonJS cache to avoid duplication.
543
527
The same object is returned in CommonJS if the JSON module has already been
544
528
imported from the same path.
Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ strictEqual(secret.ofLife, 42);
9
9
10
10
// Test warning message
11
11
const child = spawn ( process . execPath , [
12
- '--experimental-json-modules' ,
13
12
path ( '/es-modules/json-modules.mjs' ) ,
14
13
] ) ;
15
14
You can’t perform that action at this time.
0 commit comments