Skip to content

Commit 7c13c98

Browse files
committed
04 Support CJS again
1 parent b7af762 commit 7c13c98

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"engines": {
77
"node": ">=18"
88
},
9-
"main": "dist/index.js",
9+
"main": "dist/cjs/index.js",
1010
"types": "dist/index.d.ts",
1111
"module": "dist/index.js",
1212
"files": [
@@ -22,7 +22,7 @@
2222
"format:check": "npm run prettier -- -l",
2323
"clean": "rm -rf dist/*",
2424
"prebuild": "npm run format:check && npm run clean",
25-
"build": "tsc",
25+
"build": "tsc -p . && tsc -p ./tsconfig.cjs.json && echo \"{\\\"type\\\": \\\"commonjs\\\"}\" > dist/cjs/package.json",
2626
"docs": "vuepress dev docs",
2727
"docs:build": "vuepress build docs",
2828
"docs:deploy": "./scripts/deploy-docs.sh",

tsconfig.cjs.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"compilerOptions": {
3+
"module": "CommonJS",
4+
"outDir": "./dist/cjs",
5+
"sourceMap": true,
6+
"declarationMap": true,
7+
"declaration": true
8+
},
9+
"include": [
10+
"lib/**/*.ts",
11+
],
12+
"exclude": [
13+
"node_modules",
14+
"dist",
15+
".git"
16+
]
17+
}

0 commit comments

Comments
 (0)