This is a record of my experiences uplifiting CHToolbox from CommonJS to ES Modules. Some things are specific to TypeScript.
- Updage esLint configuration. While on CJS, I was stuck on esLint
8.x
. So, I was still using the old.eslintrc.js
file format. To prepare for being able to upgrade to esLint9.x
(where support has been removed for the old config format), I preemptively updated my esLint config to the new flat format (in aneslint.config.mjs
file).- This was a headache of its own since the migration path between config formats was not super clear (and the automated tools did not work for me).
- The new flat config works with both esLint
8.x
and9.x
.
- Update project configuration to target ESM:
- Set
"type": "module",
inpackage.json
- Update
compilerOptions
intsconfig.json
to have:
- Set