doc: ES module wrapper guide

📗 API Reference Docs Problem

  • Version: 14.7.0
  • Subsystem: ESM

Location

Affected URL(s):

Description

I was wondering if it would be better to write this example as:

{
  "type": "commonjs",
  "main": "./index.js",
  "exports": {
    "import": "./wrapper.mjs",
    "require": "./index.js"
  }
}

since its current form might be misleading for package maintainers that want to support both ESM and CommonJS contexts. Maybe what happened here could be prevented if the documentation was more clear.


  • I would like to work on this issue and
    submit a pull request.