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 4e2fbc2 commit a85b524
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 26 deletions.
8 changes: 0 additions & 8 deletions doc/api/cli.md
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
18 changes: 1 addition & 17 deletions doc/api/esm.md
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
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 a85b524

Please sign in to comment.