Skip to content

Commit d61f204

Browse files
fix: πŸ› CommonJS compilation target
βœ… Closes: #333
1 parent 155c349 commit d61f204

File tree

4 files changed

+57
-10
lines changed

4 files changed

+57
-10
lines changed

β€Žpackages/jest-either/package.jsonβ€Ž

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,23 @@
2828
"publishConfig": {
2929
"access": "public"
3030
},
31-
"module": "lib/index.js",
32-
"typings": "lib/index.d.ts",
31+
"main": "lib/cjs/index.js",
32+
"module": "lib/esm/index.js",
33+
"types": "lib/index.d.ts",
34+
"exports": {
35+
".": {
36+
"import": "./lib/esm/index.js",
37+
"require": "./lib/cjs/index.js"
38+
}
39+
},
3340
"directories": {
3441
"lib": "lib",
3542
"test": "test"
3643
},
3744
"scripts": {
38-
"build": "tsc",
45+
"build": "pnpm build:esm && pnpm build:cjs",
46+
"build:cjs": "tsc -p ./tsconfig.cjs.json",
47+
"build:esm": "tsc -p ./tsconfig.esm.json",
3948
"prepublish": "pnpm build"
4049
},
4150
"dependencies": {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"module": "CommonJS",
5+
"target": "ES5",
6+
"rootDir": "src",
7+
"outDir": "lib/cjs"
8+
},
9+
"include": [
10+
"src"
11+
],
12+
"references": [
13+
{
14+
"path": "../is-plain-object/tsconfig.cjs.json"
15+
}
16+
]
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"module": "ESNext",
5+
"target": "ESNext",
6+
"rootDir": "src",
7+
"outDir": "lib/esm"
8+
},
9+
"include": [
10+
"src"
11+
],
12+
"references": [
13+
{
14+
"path": "../is-plain-object/tsconfig.esm.json"
15+
}
16+
]
17+
}
Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4-
"module": "ES2020",
5-
"target": "esnext",
6-
"rootDir": "src",
7-
"outDir": "lib"
4+
"checkJs": false,
5+
"rootDir": ".",
6+
"downlevelIteration": true
87
},
9-
"include": ["src"],
10-
"exclude": ["lib"],
11-
"references": [{ "path": "../is-plain-object/tsconfig.esm.json" }]
8+
"exclude": [
9+
"lib"
10+
],
11+
"references": [
12+
{
13+
"path": "../is-plain-object"
14+
}
15+
]
1216
}

0 commit comments

Comments
Β (0)