Skip to content

doc: update packages documentation for Node.js 12 EOL

This updates the packages documentation to update some of the modules "exports" guidance with the Node.js 12 EOL, specifically:

  • "main" is no longer required as a fallback when using "exports", instead we explain how to decide which to use based on version support. I have gone quite strongly here in recommending the "exports" pattern - this guidance could certainly be relaxed to be more generous to keeping "main" around as well.
  • In all "exports" examples, I've shifted to the pattern of including the file extension in the subpath, as has kind of come to be seen as the better approach to ensure interop with import maps. I've mentioned some brief notes around this and updated all the examples, including the patterns examples to use pattern trailers.
  • I've updated the version history on subpath patterns to include the history for imports pattern support and pattern trailers support.
  • I've moved the exports sugar section higher up, this should help make the linear flow a little easier to understand since we jump between forms.
  • Added a new section on extensionless versus extensioned subpaths

/cc @nodejs/modules

Merge request reports

Loading