it’s actually not as straightforward as it should be to structure an ESM module to work across the browser and Node.js.
since CJS was dynamic it actually did an incredible job of making a lot of different package and module structures work. ESM isn’t as flexible, so knowing how to separate out the entrypoints at the top level and using self named imports in the tests is really the only way you can make it work.
it’s actually not as straightforward as it should be to structure an ESM module to work across the browser and Node.js.
since CJS was dynamic it actually did an incredible job of making a lot of different package and module structures work. ESM isn’t as flexible, so knowing how to separate out the entrypoints at the top level and using self named imports in the tests is really the only way you can make it work.