Skip to content

Commit

Permalink
fixup! module: unflag esm json modules
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoffreyBooth committed Jan 30, 2022
1 parent dc432ea commit bd1f35b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 28 deletions.
10 changes: 0 additions & 10 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,14 +290,6 @@ added:

Enable experimental `import.meta.resolve()` support.

### `--experimental-json-modules`

<!-- YAML
added: v12.9.0
-->

Enable experimental JSON support for the ES Module loader.

### `--experimental-loader=module`

<!-- YAML
Expand Down Expand Up @@ -1568,9 +1560,7 @@ Node.js options that are allowed are:
* `--enable-source-maps`
* `--experimental-abortcontroller`
* `--experimental-import-meta-resolve`
* `--experimental-json-modules`
* `--experimental-loader`
* `--experimental-modules`
* `--experimental-policy`
* `--experimental-specifier-resolution`
* `--experimental-top-level-await`
Expand Down
18 changes: 1 addition & 17 deletions doc/api/esm.md
Original file line number Diff line number Diff line change
Expand Up @@ -477,22 +477,6 @@ These CommonJS variables are not available in ES modules.
`__filename` and `__dirname` use cases can be replicated via
[`import.meta.url`][].
#### No JSON Module Loading
JSON imports are still experimental and only supported via the
`--experimental-json-modules` flag.
Local JSON files can be loaded relative to `import.meta.url` with `fs` directly:
<!-- eslint-skip -->
```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.
Expand Down Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion test/es-module/test-esm-json.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
]);

Expand Down

0 comments on commit bd1f35b

Please sign in to comment.