ChromaticHQ / calliope

An opinionated yet extensible toolset to handle common front-end tasks
3 stars 0 forks source link

Add support for ESM-only packages #51

Open agarzola opened 11 months ago

agarzola commented 11 months ago

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

Proposed Solution

Follow this Gulp-centric guide to support ESM.

Alternatives Considered

Additional Context

agarzola commented 11 months ago

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.