1
Fork 0

expose working CJS and ESM builds with pkg.exports

This commit is contained in:
Conduitry 2021-09-19 07:42:58 -04:00
parent 84f4a6c1fa
commit 4d22e70318
2 changed files with 11 additions and 4 deletions

View file

@ -8,8 +8,15 @@
"async",
"watch"
],
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
},
"./package.json": "./package.json"
},
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "types/index.d.ts",
"files": [
"*.md",

View file

@ -5,7 +5,7 @@ export default {
external: name => /^[a-z]/.test(name),
plugins: [cheap_ts()],
output: [
{ file: 'dist/index.cjs.js', format: 'cjs', sourcemap: true, interop: false, preferConst: true },
{ file: 'dist/index.esm.js', format: 'esm', sourcemap: true, preferConst: true },
{ file: './dist/index.cjs', format: 'cjs', sourcemap: true, interop: false, preferConst: true },
{ file: './dist/index.mjs', format: 'esm', sourcemap: true, preferConst: true },
],
};