Skip to content

Commit b6671bc

Browse files
OttoAllmendingerllm-git
andcommitted
feat(utxo-staking): add ESM build support
Configure dual CommonJS/ESM output for utxo-staking module. Update package.json with proper export conditions and file paths. Add ESM-specific tsconfig. Issue: BTC-2732 Co-authored-by: llm-git <[email protected]>
1 parent 658a096 commit b6671bc

File tree

3 files changed

+39
-6
lines changed

3 files changed

+39
-6
lines changed

modules/utxo-staking/package.json

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,30 @@
22
"name": "@bitgo/utxo-staking",
33
"version": "1.25.0",
44
"description": "BitGo SDK for build UTXO staking transactions",
5-
"main": "./dist/src/index.js",
6-
"types": "./dist/src/index.d.ts",
5+
"main": "./dist/cjs/src/index.js",
6+
"module": "./dist/esm/index.js",
7+
"browser": "./dist/esm/index.js",
8+
"types": "./dist/cjs/src/index.d.ts",
79
"files": [
8-
"dist/src"
10+
"dist/cjs",
11+
"dist/esm"
912
],
13+
"exports": {
14+
".": {
15+
"import": {
16+
"types": "./dist/esm/index.d.ts",
17+
"default": "./dist/esm/index.js"
18+
},
19+
"require": {
20+
"types": "./dist/cjs/src/index.d.ts",
21+
"default": "./dist/cjs/src/index.js"
22+
}
23+
}
24+
},
1025
"scripts": {
11-
"build": "yarn tsc --build --incremental --verbose .",
26+
"build": "npm run build:cjs && npm run build:esm",
27+
"build:cjs": "yarn tsc --build --incremental --verbose .",
28+
"build:esm": "yarn tsc --project tsconfig.esm.json",
1229
"fmt": "prettier --write .",
1330
"check-fmt": "prettier --check '**/*.{ts,js,json}'",
1431
"clean": "rm -r ./dist",
@@ -41,7 +58,6 @@
4158
".ts"
4259
]
4360
},
44-
"type": "commonjs",
4561
"dependencies": {
4662
"@babylonlabs-io/babylon-proto-ts": "1.7.2",
4763
"@bitgo/babylonlabs-io-btc-staking-ts": "^3.1.0",
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+
"outDir": "./dist/esm",
5+
"rootDir": "./src",
6+
"module": "ES2020",
7+
"target": "ES2020",
8+
"moduleResolution": "bundler",
9+
"lib": ["ES2020", "DOM"],
10+
"declaration": true,
11+
"declarationMap": true,
12+
"skipLibCheck": true
13+
},
14+
"include": ["src/**/*", "src/babylon/*.json"],
15+
"exclude": ["node_modules", "test", "dist", "scripts"],
16+
"references": []
17+
}

modules/utxo-staking/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4-
"outDir": "./dist",
4+
"outDir": "./dist/cjs",
55
"rootDir": ".",
66
"typeRoots": ["./node_modules/@types", "../../node_modules/@types"],
77
"allowJs": false,

0 commit comments

Comments
 (0)