From a85b5244274d8211ae8a9ef45e6bca68219815ae Mon Sep 17 00:00:00 2001 From: Geoffrey Booth Date: Sat, 29 Jan 2022 18:25:39 -0800 Subject: [PATCH] fixup! module: unflag esm json modules --- doc/api/cli.md | 8 -------- doc/api/esm.md | 18 +----------------- test/es-module/test-esm-json.mjs | 1 - 3 files changed, 1 insertion(+), 26 deletions(-) diff --git a/doc/api/cli.md b/doc/api/cli.md index 76c122fc16dd0b..694fa66181ca2a 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -290,14 +290,6 @@ added: Enable experimental `import.meta.resolve()` support. -### `--experimental-json-modules` - - - -Enable experimental JSON support for the ES Module loader. - ### `--experimental-loader=module` - -```js -import { readFile } from 'fs/promises'; -const json = JSON.parse(await readFile(new URL('./dat.json', import.meta.url))); -``` - -Alternatively `module.createRequire()` can be used. - #### No Native Module Loading Native modules are not currently supported with ES module imports. @@ -538,7 +522,7 @@ import packageConfig from './package.json' assert { type: 'json' }; The `assert { type: 'json' }` syntax is mandatory; see [Import Assertions][]. -The imported JSON only exposes a `default`. There is no support for named +The imported JSON only exposes a `default` export. There is no support for named exports. A cache entry is created in the CommonJS cache to avoid duplication. The same object is returned in CommonJS if the JSON module has already been imported from the same path. diff --git a/test/es-module/test-esm-json.mjs b/test/es-module/test-esm-json.mjs index e19762c6e61a71..6d55419eedc857 100644 --- a/test/es-module/test-esm-json.mjs +++ b/test/es-module/test-esm-json.mjs @@ -9,7 +9,6 @@ strictEqual(secret.ofLife, 42); // Test warning message const child = spawn(process.execPath, [ - '--experimental-json-modules', path('/es-modules/json-modules.mjs'), ]);