Skip to content

Commit

Permalink
build: use backward compatible cjs wrapper for default export
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Mar 31, 2023
1 parent 4a01304 commit e2e6aa6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 9 additions & 0 deletions lib/index.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const lib = require("../dist/index.cjs");

module.exports = lib.consola;

for (const key in lib) {
if (!(key in module.exports)) {
module.exports[key] = lib[key];
}
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@
".": {
"node": {
"types": "./dist/index.d.ts",
"require": "./dist/index.cjs",
"require": "./lib/index.cjs",
"import": "./dist/index.mjs"
},
"default": {
"types": "./dist/index.browser.d.ts",
"require": "./dist/index.browser.cjs",
"import": "./dist/index.browser.mjs"
}
}
},
"main": "./dist/index.cjs",
"main": "./lib/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist",
"lib",
"types"
],
"scripts": {
Expand Down Expand Up @@ -68,4 +68,4 @@
"winston": "^3.8.2"
},
"packageManager": "[email protected]"
}
}

0 comments on commit e2e6aa6

Please sign in to comment.