Open GeoffreyBooth opened 5 years ago
I assume we’re not providing a default, and basically it’s on the user to define an entry point if they expect their package to be importable.
Exactly, it would just throw for no main found.
(Unless we want to define a default behaviour for ESM?)
No, because a) we'd need to choose between index.mjs and index.js, and b) the idea of a default like that feels like the default folder root of CommonJS that we're not continuing in ESM.
What if a user’s entire
package.json
is just{ "mode": "esm" }
? Does the package have an implied"main"
or default entry point, like how CommonJS defaults toindex.js
if"main"
isn’t defined?I assume we’re not providing a default, and basically it’s on the user to define an entry point if they expect their package to be importable. (Not all packages need to be importable, for example a user’s project that is never intended to be imported by something else, such as something generated via
create-react-app
.)