Merge pull request #110 from ycjcl868/fix/module-format

fix: add cjs format support
This commit is contained in:
Justin Spahr-Summers 2025-01-10 10:19:31 +00:00 • committed by GitHub
commit 29d08ff801
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 7 deletions

View file

@ -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
View file

@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"outDir": "./dist/cjs"
},
"exclude": ["**/*.test.ts"]
}

View file

@ -1,6 +1,7 @@
{
"extends": "./tsconfig.json",
"exclude": [
"**/*.test.ts",
]
"compilerOptions": {
"outDir": "./dist/esm"
},
"exclude": ["**/*.test.ts"]
}