expose working CJS and ESM builds with pkg.exports

development^2
Conduitry 1 year ago
parent 84f4a6c1fa
commit 4d22e70318
  1. 11
      package.json
  2. 4
      rollup.config.js

@ -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",

@ -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 },
],
};

Loading…
Cancel
Save