bee-js icon indicating copy to clipboard operation
bee-js copied to clipboard

Adopt ESM

Open AuHau opened this issue 2 years ago • 1 comments

There is a general shift in the JS ecosystem from the CommonJS module into native EcmaScript Modules. Currently, it is natively supported in the whole ecosystem, but for Node 12 it is hidden behind an experimental flag that the user would have to use.

Few of our dependencies already made the switch and that brings us to the fact that we will have to adopt it sooner or later. The main problem is that it is not possible to synchronously import ESM package, so it requires us to become ESM package in order to import those.

This switch will impose the requirement to use ESM on our users as well, so for now we are not doing the switch but in close future, it should happen. Currently, as we agreed the end-of-life of Node 12 seems like a good milestone when to revisit this as then it will be natively supported in the ecosystem without any need for flags and other barriers.

AuHau avatar Aug 17 '21 13:08 AuHau

As the Node 12 EOL (30th of April) is approaching we revisited this issue. We have come up with a transition period that starts with the 3.3.0 release which will introduce a hybrid build that supports both CommonJS and ES Modules. This is the time to start preparing your (build) stack for the adoption of ESM as the plan is to drop CommonJS around 30th of April.

AuHau avatar Feb 09 '22 14:02 AuHau