Skip to content

doc: esm: options for package authors

This updates the ECMAScript Modules docs with a few changes agreed in recent modules group meetings:

  • Per the 2019-06-19 meeting, we decided that we want to encourage all package authors to always include the package.json "type" field, even for CommonJS packages (where "type": "commonjs" is implied).

  • Per the 2019-08-28 meeting, we decided that the docs needed more discussion of packages and specifically what options are available for package authors wishing to support both CommonJS and ESM consumers of packages, and both current and older versions of Node.

Regarding the latter, this PR is just a first step; it will need expansion if/when #29494 is merged in, and possibly again later if more improvements are made to better support different module systems or Node runtime versions. For now, though, I think this text is an improvement on the very minimal mention that dual CommonJS/ESM support in packages has currently.

Checklist

//cc @nodejs/modules-active-members

Merge request reports

Loading