ryansonshine/typescript-npm-package-template

Suggestion for compatibility

Closed this issue · 1 comments

sneko commented

Hi,

JavaScript is by definition a big mess in term of compatibility of imports... ^^

I did on a library some compatible generation for ESM/CommonJS/UMD that you can find here https://github.com/sneko/utm-synapse/blob/main/package.json#L5-L21

I don't know if it can help improving the template, but when including the library in a CJS project, having a compatible generation saves lives 😄

NB: it requires both rollup and uglifyjs as deps

Hey @sneko ! This is a great suggestion, I've actually been following the progress of TypeScript native support for ESM as outline in this announcement for TypeScript 4.7 beta.

Once this makes it's way out of beta I'll look at adding dual support.