Skip to content

Commit

Permalink
fix dual CommonJS/ES module entry points
Browse files Browse the repository at this point in the history
  • Loading branch information
pdelacroix committed Dec 16, 2023
1 parent 316960d commit f0c137b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
"publishConfig": {
"access": "public"
},
"main": "dist/index.js",
"module": "dist/index.es.js",
"type": "module",
"exports": {
"require": "dist/index.cjs",
"import": "dist/index.mjs"
},
"files": [
"dist/index.js",
"dist/index.es.js",
"dist/index.cjs",
"dist/index.mjs",
"src/index.js",
"rollup.config.js"
],
Expand Down
4 changes: 2 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
input: 'src/index.js',
external: Object.keys(pkg.dependencies),
output: [
{ format: 'cjs', file: pkg.main, exports: 'auto' },
{ format: 'esm', file: pkg.module }
{ format: 'cjs', file: pkg.exports.require, exports: 'auto' },
{ format: 'esm', file: pkg.exports.import }
]
};

0 comments on commit f0c137b

Please sign in to comment.