userfrosting / gulp-uf-bundle-assets

Orchastrates JS and CSS bundle creation in an efficient and configurable manner.
MIT License
6 stars 0 forks source link

Node Native ESM Support #31

Closed Silic0nS0ldier closed 3 years ago

Silic0nS0ldier commented 4 years ago

As of NodeJS 13, ES Modules are now stable. Furthermore, there are strategies for backward compatible adoption.

At this stage, there are upstream dependencies (e.g. AVA https://github.com/avajs/ava/issues/2293) and likely corner cases to consider (mainly around CJS and ESM boundaries). Regardless, it is worth putting some thought into native ESM support can be achieved. Particularly as quicker adoption means less transpilation is needed (meaning more predictable issues in the wild).

Silic0nS0ldier commented 4 years ago

AVA v3 has arrived, but only with the groundwork for ES modules support. At the time of writing I'm unaware of any work arounds to have AVA continue with the esm package anyway.

Given this, as much of the groundwork (import paths, bulk of package config) will be done in the meantime to permit a speedier implementation later on.

Silic0nS0ldier commented 4 years ago

AVA v3.3 added support for loading ES module tests. Some creativity may be needed to ensure both entrypoints are tested, and that they can be properly consumed.

Silic0nS0ldier commented 4 years ago

ESM code can now be imported in Node 12 and above without the experimental flag.

Silic0nS0ldier commented 4 years ago

Native ESM is working (yay!) but we'll need to purge esm from the sibling packages for this to work correctly.

Pausing this until https://github.com/userfrosting/merge-package-dependencies/issues/15 is resolved, after which the migration can begin.

Silic0nS0ldier commented 3 years ago

https://github.com/userfrosting/merge-package-dependencies/issues/15 is a significant refactor which demands a lot of attention. I've got time back on my side (so it'll get done) however with NodeJS 10 soon to leave maintenance level support, I need to get the esm adapter out of everything ASAP to avoid major breakages.

This is now unblocked.