Skip to content

Commit

Permalink
Merge pull request #1039 from neet/masquerading-as-esm
Browse files Browse the repository at this point in the history
fix: Fix "Masquerading as ESM"
  • Loading branch information
neet committed Feb 22, 2024
2 parents 121f901 + 4d88a43 commit ea38407
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
"module": "./dist/index.js",
"exports": {
".": {
"types": "./dist/index.d.ts",
"types": {
"require": "./dist/index.d.cts",
"import": "./dist/index.d.ts"
},
"require": "./dist/index.cjs",
"import": "./dist/index.js"
}
Expand Down
16 changes: 12 additions & 4 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,31 @@ export default [
input: "./src/index.ts",
output: {
file: packageJSON.exports["."].require,
format: "cjs",
format: "commonjs",
},
plugins: [json(), typescript(), autoExternal()],
},
{
input: "./src/index.ts",
output: {
file: packageJSON.exports["."].import,
format: "esm",
format: "module",
},
plugins: [commonjs(), json(), typescript(), autoExternal()],
},
{
input: "./src/index.ts",
output: {
file: packageJSON.exports["."].types,
format: "esm",
file: packageJSON.exports["."].types["require"],
format: "commonjs",
},
plugins: [commonjs(), dts()],
},
{
input: "./src/index.ts",
output: {
file: packageJSON.exports["."].types["import"],
format: "module",
},
plugins: [dts()],
},
Expand Down

0 comments on commit ea38407

Please sign in to comment.