Skip to content

Commit e44df5c

Browse files
Merge pull request #8288 from BitGo/BTC-3148-sdk-coin-dot-esm-cjs
feat(sdk-coin-dot): add dual ESM/CJS build for browser WASM support
2 parents 0ad731a + f99683a commit e44df5c

3 files changed

Lines changed: 40 additions & 6 deletions

File tree

modules/sdk-coin-dot/package.json

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,29 @@
22
"name": "@bitgo/sdk-coin-dot",
33
"version": "4.11.7",
44
"description": "BitGo SDK coin library for Polkadot",
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",
9+
"exports": {
10+
".": {
11+
"import": {
12+
"types": "./dist/esm/index.d.ts",
13+
"default": "./dist/esm/index.js"
14+
},
15+
"require": {
16+
"types": "./dist/cjs/src/index.d.ts",
17+
"default": "./dist/cjs/src/index.js"
18+
}
19+
}
20+
},
721
"scripts": {
8-
"build": "yarn tsc --build --incremental --verbose .",
22+
"build": "npm run build:cjs && npm run build:esm",
23+
"build:cjs": "yarn tsc --build --incremental --verbose .",
24+
"build:esm": "yarn tsc --project tsconfig.esm.json",
925
"fmt": "prettier --write .",
1026
"check-fmt": "prettier --check '**/*.{ts,js,json}'",
11-
"clean": "rm -r ./dist",
27+
"clean": "rm -rf ./dist",
1228
"lint": "eslint --quiet .",
1329
"prepare": "npm run build",
1430
"test": "npm run coverage",
@@ -66,6 +82,7 @@
6682
},
6783
"gitHead": "18e460ddf02de2dbf13c2aa243478188fb539f0c",
6884
"files": [
69-
"dist"
85+
"dist/cjs",
86+
"dist/esm"
7087
]
7188
}
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/**/*"],
15+
"exclude": ["node_modules", "test", "dist"],
16+
"references": []
17+
}

modules/sdk-coin-dot/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
"strictPropertyInitialization": false,
77
"esModuleInterop": true,

0 commit comments

Comments
 (0)