Skip to content

Commit c677661

Browse files
Merge pull request #6 from idanen/build-esm
build: Add build for native ES modules
2 parents c9f97ed + 4d0448d commit c677661

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,20 @@
44
"description": "",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
7+
"module": "dist/esm/index.js",
78
"scripts": {
89
"add-contributor": "kcd-scripts contributors add",
9-
"build": "tsc -p tsconfig.build.json",
10+
"build": "npm-run-all build:cjs build:esm",
11+
"build:cjs": "tsc -p tsconfig.build.json",
12+
"build:esm": "tsc -p tsconfig.esm.json",
1013
"lint": "kcd-scripts lint",
1114
"test:unit": "kcd-scripts test --no-watch --config=jest.config.js",
1215
"validate": "kcd-scripts validate build,lint,test,typecheck",
1316
"test": "wdio wdio.conf.js",
1417
"semantic-release": "semantic-release",
1518
"typecheck:async": "tsc -p ./test/async/tsconfig.json",
1619
"typecheck:sync": "tsc -p ./test/sync/tsconfig.json",
17-
"typecheck:build": "npm run build -- --noEmit",
20+
"typecheck:build": "npm run build:cjs -- --noEmit && npm run build:esm -- --noEmit",
1821
"typecheck": "npm-run-all typecheck:build typecheck:**"
1922
},
2023
"files": [

tsconfig.esm.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"module": "esnext",
5+
"outDir": "./dist/esm",
6+
"moduleResolution": "node",
7+
"declaration": true,
8+
"noEmit": false
9+
},
10+
"exclude": ["test", "dist"]
11+
}

0 commit comments

Comments
 (0)