Modern tooling can leverage exports maps in the package.json to allow consumers to only import what you want to expose as a contract. They can also help define how to resolve those files based on different environments.
Bundlers also require ESM to be distributed in order to support tree shaking. i see consumers in our apps using this package, but tree shaking bails out due to CJS only. If you addd ESM, you can leverage exports to map out where things are located and what can/should be imported.
Modern tooling can leverage
exports
maps in the package.json to allow consumers to only import what you want to expose as a contract. They can also help define how to resolve those files based on different environments.Bundlers also require ESM to be distributed in order to support tree shaking. i see consumers in our apps using this package, but tree shaking bails out due to CJS only. If you addd ESM, you can leverage
exports
to map out where things are located and what can/should be imported.Example: