isaacs / tshy

Other
890 stars 18 forks source link

`"main": false` field is incorrectly removed from package.json #39

Closed petersalas closed 11 months ago

petersalas commented 11 months ago

In exports.ts, the following:

const mod = resolveExport(pkg.exports['.'], ['require'])
const main = c?.main ?? !!mod
if (main) {
  /* [snip] */
} else {
  if (c) delete c.main
  /* [snip] */
}

neglects that main might be false due to c?.main being false even when a . export is defined.

The effect is that it's not possible to durably set "main": false when a . export is defined.