Merge pull request #110 from ycjcl868/fix/module-format
fix: add cjs format support
This commit is contained in:
commit
29d08ff801
3 changed files with 22 additions and 7 deletions
13
package.json
13
package.json
|
|
@ -19,12 +19,15 @@
|
|||
"mcp"
|
||||
],
|
||||
"exports": {
|
||||
"./*": "./dist/*"
|
||||
"./*": {
|
||||
"import": "./dist/esm/*",
|
||||
"require": "./dist/cjs/*"
|
||||
}
|
||||
},
|
||||
"typesVersions": {
|
||||
"*": {
|
||||
"*": [
|
||||
"./dist/*"
|
||||
"./dist/esm/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
@ -32,8 +35,10 @@
|
|||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsc -p tsconfig.prod.json",
|
||||
"prepack": "tsc -p tsconfig.prod.json",
|
||||
"build": "npm run build:esm && npm run build:cjs",
|
||||
"build:esm": "tsc -p tsconfig.prod.json && echo '{\"type\": \"module\"}' > dist/esm/package.json",
|
||||
"build:cjs": "tsc -p tsconfig.cjs.json && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json",
|
||||
"prepack": "npm run build:esm && npm run build:cjs",
|
||||
"lint": "eslint src/",
|
||||
"test": "jest",
|
||||
"start": "npm run server",
|
||||
|
|
|
|||
9
tsconfig.cjs.json
Normal file
9
tsconfig.cjs.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "./dist/cjs"
|
||||
},
|
||||
"exclude": ["**/*.test.ts"]
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"exclude": [
|
||||
"**/*.test.ts",
|
||||
]
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist/esm"
|
||||
},
|
||||
"exclude": ["**/*.test.ts"]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue