api3dao / commons

Common utilities, modules and configurations used in API3 projects
MIT License
0 stars 2 forks source link

Create separate entry point for FE and BE #46

Closed Siegrift closed 9 months ago

Siegrift commented 9 months ago

Closes https://github.com/api3dao/commons/issues/45 Related to https://github.com/api3dao/commons/pull/18

Rationale

The idea is to use separate entrypoints for Node.js and universal (runs both on browser and Node.js) code. This is accomplished via browser field and exports field.

I intentionally name it as "universal" instead of "browser". If we end up adding some browser-only code to commons, it would make sense to separate this into multiple packages, because this can't be easily done without using exports only, which is not backwards compatible. Also, having a single package for these 3 cases is pretty complex.

I double checked the usage on a freshly created FE app and one of our private Node.js services.