import script --> .esm

Kevin Smith zenparsing at
Wed Sep 10 19:52:52 PDT 2014

> Wrt to the proposed `default.js` convention: node doesn't *need* to
> specify a main entry point in the `package.json`. It could have chosen an
> arbitrary convention.
Clearly, and it already did:  "index.js".  My (perhaps imperfect)
understanding of history is that support for the "main" configuration
setting arose out of a desire to support CommonJS's "package.json" format
(which defined such a field).

> Overriding the entry point allows for extra flexibility in practice,
> especially when adapting to legacy projects' existing directory structures.
I don't follow.  Can you expand on this?  How is using "main" any better
than adding a "default.js" which simply re-exports the desired entry point?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list