Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup: be explicit about other limitations of ./ export
  • Loading branch information
MylesBorins committed May 4, 2020
commit a1614cc300aa7c0fa55a2739f375770b25ed125c
4 changes: 3 additions & 1 deletion doc/api/esm.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ a project that previous exported `main`, `lib`,

```json
{
"name": "my-mod",
"exports": {
".": "./lib/index.js",
"./lib": "./lib/index.js",
Expand All @@ -230,6 +231,7 @@ Alternatively a project could choose to export entire folders:

```json
{
"name": "my-mod",
"exports": {
".": "./lib/index.js",
"./lib": "./lib/index.js",
Expand All @@ -243,7 +245,7 @@ Alternatively a project could choose to export entire folders:

As a last resort, package encapsulation can be disabled entirely by creating an
export for the root of the package `"./": "./"`. This will expose every file in
Comment thread
hybrist marked this conversation as resolved.
the package at the cost of disabling encapsulation.
the package at the cost of disabling encapsulation. As the ES Module loader in Node.js will not resolve file extensions or an `index.js` exporting the root is less expressive than either of the above examples as individuals will be unable to `import feature from 'my-mod/feature'`.

#### Main Entry Point Export

Expand Down