Open
Description
🛣️ The road to modern ESM
Working with ESM only dependencies is still hard in 2024. And we want to do our part and make all people of all code styles and environments happy!
👟 Core and CDA are ready(ish) released!
To make this happen, we have to do kind of a leap forward. We already have the SDK-CORE prepared and the CDA.js is also ready for review
🔨 List of todos
These are based on the learnings from our other repos:
- upgrade as many dependencies as we can - build: dependency update that passes all tests #2335 & Build: cleanup dependencies #2336 & Build: improve eslint + typescript compat #2338 (as this has to be a major/breaking update)
- migrate to latest typescript - build: upgrade typescript to v5 #2337 (handles ESM better - plus a major that has to come anyways)
- switch to vitest - Refactor: replace test suite with vitest #2328 (less trouble with ESM as with jest. Here we don't even have jest, this still runs on chai+mocha+chai which have (big?) issues with ESM as well)
- migrate dev dependencies to ease up support for modern syntaxes and dependencies Migrate to eslint v9 #2486 + Migrate to husky v9 #2487
potential breaking changes below here
PR with breaking changes: #2472
- switch to contentful-sdk-core with pure ESM support
- switch to rollup (better ESM handling, faster, all packages use same bundler now)
- remove the minified node bundle (no need as it will be loaded only once!)
- make available in cjs (maybe as a bundle for node without ESM support)
- make available in pure esm (through a simple tsc compile)
- support ESM only dependencies (it is time, we are starting to lack behind and create dependency issues with modern setups)
- compatibility for browser modules and still provide a minified bundle for browser (hopefully used for demos, and not production)
👏 Will fix:
These changes should solve the following issues:
- Svelte kit Adapter Issue #1799
- ESM not usable in Node #1927
- import issue on nuxt 3 #1458
- contentful is undefined when importing via ES6 style #2241
- Browser usage via script tag? #2032
- and others having issues using this repo in modern environments