Provide explicit ESM and CommonJS exports.

Review Request #13556 — Created Feb. 19, 2024 and submitted — Latest diff uploaded

Information

Spina
master

Reviewers

Spina now provides exports for ESM modules and for CommonJS modules,
making it easier to consume in projects.

The ESM modules export all the Spina exports along with a "Spina"
default export that encompasses everything as a top-level namespace.

The CommonJS modules behave as normal, since one is expected to do
const Spina = require('@beanbag/spina');.

Notably, we are not setting "type": "module" in package.json, as our
main export is a UMD module and not a ESM module. This is important for
consumption in browsers, and also for compilation/unit testing in
general (setting it to "module" breaks all sorts of things).

There's also a fix that was found in the process where tsc wasn't
getting run correctly. Once fixed, it found a missing type import,
which has been addressed.

Successfully built and consumed Spina.

Commits

Files