title icon indicating copy to clipboard operation
title copied to clipboard

Update all dependencies to latest and support ESM

Open leerob opened this issue 2 years ago • 2 comments

It'd be great to support both ESM and CJS here.

https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

leerob avatar Feb 12 '22 21:02 leerob

support both ESM and CJS

I'd like to clarify my interpretation of the intent of the issue. The way I understand it, we'd like to convert the (currently) CommonJS title package into a pure ESM project. That would imply a breaking change for CommonJS consumers of the title package that would force them to pursue one of the 3 options presented at the beginning of the linked gist.

i.e., the "support" for CJS would come from the following point made in the gist:

  1. If the package [e.g., title] is used in an async context, you could use await import(…) from CommonJS instead of require(…).

Would that interpretation be correct?

bryan-hoang avatar Feb 14 '22 01:02 bryan-hoang

So that document shows how to make a pure ESM package. There are pros to that. If possible, it would be great to support both CJS and ESM for best backwards compat. I'm not an expert here, but ms recently made this change.

https://github.com/vercel/ms/pull/163

leerob avatar Feb 16 '22 04:02 leerob