title icon indicating copy to clipboard operation
title copied to clipboard

refactor: migrate to using esms

Open bryan-hoang opened this issue 2 years ago • 0 comments

To address #69, I read through an article about how to convert packages to pure ESM ^1. cjstoesm was quite helpful here ^2.

But it didn't talk about how to still support being imported by CJS modules without the use of dynamic imports. It's annoying being forced to change the color of a function ^3.

I came across another article discussing a more streamlined way to build a package for consumers of either module format ^4, and I wanted to try out unbuild ^5.

The current version of ava used doesn't support ESMs. Given that updating to a major version that does support it would lead to more code changes from breaking changes, I decided to switch to using Vitest.

There were also issues with importing older versions of chalk into ESMs, so I opted to update chalk to v5 (ESM).

titleize was removed as an unused dependency.

Resolves #69.

bryan-hoang avatar Sep 17 '23 00:09 bryan-hoang