Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ESM-only packages #51

Open
1 task
agarzola opened this issue Oct 31, 2023 · 1 comment
Open
1 task

Add support for ESM-only packages #51

agarzola opened this issue Oct 31, 2023 · 1 comment
Assignees

Comments

@agarzola
Copy link
Member

agarzola commented Oct 31, 2023

Description

Several tools we use in our front-end toolchain (e.g. del, gulp-imagemin) have abandoned CommonJS (CJS) in favor of ECMAScript Modules (ESM). Our tooling uses CJS (as that has been the standard for Node.js projects since time immemorial), which cannot import ESM modules.

We should take steps to upgrade our tooling so that it can support both ESM and CJS, so that we are free to use whatever packages best solve our problems without worrying about whether the module-loading system is supported.

Issue Owner

Acceptance Criteria

  • Calliope supports ESM-only packages along with CJS packages.

Proposed Solution

Follow this Gulp-centric guide to support ESM.

Alternatives Considered

  • Stay on the dual-loading versions of modules that have moved on to ESM-only.
    This is not a good idea, as we would stop receiving patches and new feature updates.
  • Replace ESM-only modules with similar packages that support CJS.
    This may work, but it means that we are limiting the pool of packages available to our devs to only those that support CJS. It also means that every time a package is updated to only support ESM, work is created for our team to find a CJS-compatible equivalent, one which may or may not exist.

Additional Context

@agarzola agarzola self-assigned this Oct 31, 2023
@agarzola
Copy link
Member Author

Some initial explorations reveal a complication with the way that we dynamically export tasks from config. Namely, that ESM does not seem to support dynamic exports, so this clever trick we pull to automatically export custom tasks defined downstream so that Gulp can pick them up will need to be refactored in some way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant