Support for ESM
stijnvanhulle opened this issue · comments
Problem
Right now the package.json
only contains main and types. That works most of the time fine but when using native ESM it will complain because inside the dist/index.js
there is a require
which is not supported by ESM.
Solution
- Add "type": "module"
- Add native ESM bundle
- Add exports with support for CJS(as today) and ESM
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js", //esm
"module": "./dist/index.js", //esm
"default": "./dist/index.cjs" //cjs
}
},
Hi, we don't have any plans to natively support ESM at the moment but if you'd like to submit a PR to this repo to get it working to where the library could still be used in a CJS project, even with type: module
present, we're open to pulling it in.