ericcornelissen/shescape

Remove `"main"` field from the package manifest

Closed this issue · 1 comments

Enhancement

Description

Currently, the project manifest specifies both a "main" and "exports" field:

shescape/package.json

Lines 8 to 12 in f42fc7d

"main": "./index.cjs",
"exports": {
"import": "./index.js",
"require": "./index.cjs"
},

These serve roughly the same purpose (i.e. telling project using this package how it should be imported). Per 1:

"main" - The default module when loading the package, if exports is not specified, and in versions of Node.js prior to the introduction of exports.
[...]
"exports" - Package exports and conditional exports. When present, limits which submodules can be loaded from within the package.

So, the "main" field may be removed in the future. Per the history at 2, this requires a higher supported Node.js version. "exports" was first introduced in v12.7.0, so as of writing1 that's the minimum Node.js version that this package should require before the "main" field can be removed.


Relates to: #193

Footnotes

  1. As of writing because patterns support was added only in v12.20.0/v14.13.0. When this issues is being worked on, it should be verified that either 1) patterns aren't used, or 2) the minimum Node.js version is such that patterns are supported.

This was first available in 2.0.0-rc1.