Skip to content

Commit

Permalink
Merge pull request #18 from algorandfoundation/feat/cjm-and-esm
Browse files Browse the repository at this point in the history
docs: clarify on CJS AFE-188
  • Loading branch information
HashMapsData2Value authored Jan 21, 2025
2 parents 4b73ec0 + 8dae33e commit 6eb7840
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
README.md
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,28 @@ $ yarn
$ yarn test
```

## Regarding CJS

This library can be used in a CommonJS environment as a dynamic import:

```ts
;(async function () {
const hd = await import("@algorandfoundation/xhd-wallet-api");
})();
```

Make sure to set your tsconfig.json so it is at least:

```json
{
"target": "es2020",
"module": "Node16",
"moduleResolution": "Node16"
}
```

# Test

## Output

```shell
Expand Down
8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@
"name": "@algorandfoundation/xhd-wallet-api",
"version": "1.0.2",
"description": "A Typescript implementation of Algorand ARC-52 extended hierarchical determinstic wallets.",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"type": "module",
"scripts": {
"build": "tsc && tsc-alias -p tsconfig.json -f",
Expand Down

0 comments on commit 6eb7840

Please sign in to comment.