Closed guybedford closed 5 years ago
Setting exports
to false
should work now and we have a test for it.
(specifically, Object.assign/Object.keys semantics will be used, so any value without enumerable keys will be the same as {}
, including false
)
@ljharb Just to clarify… we're talking here about { "exports": false }
not { "exports": "false" }
as per op text, right?
The latter would assign/key as { 0: "f" … 4: "e" }
… right?
The former, yes. The latter is a valid string value for the field.
@guybedford do we want to revise the op text to read { "exports": false }
not { … "false" }
avoid confusion?
Sure, have done that.
I've just been working out the interaction here with the "mode" spec ideas, and one thing that comes up then is that if we do allow the "main" to point to ".mjs" files, would we want "exports" to be able to be an empty object to get encapsulation:
A simpler form of the above might be just:
where it is clear that is then a "frozen" package as it were.
It only really makes sense if the main field is kept with the mode proposal, but thought we should discuss it here first.