Skip to content

Commit a05249d

Browse files
committed
docs updates
1 parent 84060fb commit a05249d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

doc/api/modules.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,14 @@ by tools converting ES modules into CommonJS modules, following existing ecosyst
233233
conventions. Code authored directly in CommonJS should avoid depending on it.
234234

235235
To create an ESM module that should provide an arbitrary value to CommonJS, the
236-
`__cjsUnwrapDefault: true` marker can be used instead:
236+
`cjsUnwrapDefault: true` marker can be used instead:
237237

238238
```mjs
239239
// point.mjs
240240
export default class Point {
241241
constructor(c, x) { this.x = x; this.y = y; }
242242
}
243-
export const __cjsUnwrapDefault = true;
243+
export const cjsUnwrapDefault = true;
244244
```
245245

246246
```cjs
@@ -249,6 +249,9 @@ console.log(point);
249249
// [class Point]
250250
```
251251

252+
When using `cjsUnwrapDefault`, no named exports other than the `default` export
253+
will be accessible to CommonJS importers.
254+
252255
If the module being `require()`'d contains top-level `await`, or the module
253256
graph it `import`s contains top-level `await`,
254257
[`ERR_REQUIRE_ASYNC_MODULE`][] will be thrown. In this case, users should

0 commit comments

Comments
 (0)