jspm / registry

The jspm registry and package.json override service
https://jspm.io
229 stars 256 forks source link

I'm confused by the module format documentation in the wiki #1069

Open popham opened 6 years ago

popham commented 6 years ago

I'm adding a jspm section to a library of mine, but I'm confused by Configuring-Packages-for-jspm. What does "Module format esm (ECMAScript Module) currently isn't used in package.json" mean? In particular, "isn't used" by whom?

aluanhaddad commented 6 years ago

By used it means used by JSPM. It actually is used. I think the documentation needs to be updated.

For example, say that the jspm section of your package specifies files that are distributed in a format other than CommonJS. This could be amd, esm, global, etc.

By specifying that property you provide metadata that enables the package to be loaded and bundled correctly.

For example, in the case of esm, people installing your package will be able to take advantage of rollup optimizations when they create a production build. It also means that the SystemJS loader doesn't have to attempt module format detection heuristics which enables your package to be transpiled faster and with no ambiguity as to format.

aluanhaddad commented 6 years ago

Actually, I believe the documentation is saying that the property is not considered if it is not nested under the jspm section.