Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
packaging: distribute @cockroachlabs/icons with ESM and CommonJS vers…
…ions Distributing an ES Modules-formatted package makes tree-shaking of unused exports significantly simpler for packages that consume /icons. Node's support for ESM is still experimental though, and Jest by default won't transform anything in node_modules. Using that ESM build wouldn't work, and would require the previous CommonJS format. This left us with a dilemma: Either distribute something that can be bundled efficiently and effectively (ESM), or ship something that's easy to use in tests (CJS). Luckily that's actually a false dilemma: we can just ship both. Bundlers like webpack will read the 'module' field in package.json and receive the easily-bundled ES Modules format. Node (and by extension, Jest) will read the 'main' field in package.json and receive the no-transformation- necessary CommonJS format. Everyone wins!
- Loading branch information