Skip to content

Commit

Permalink
tsconfig.esm: set moduleResolution to Node16 (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocavue committed Feb 12, 2024
1 parent 1a951ca commit 11df073
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"node:crypto": false
},
"node": {
"./crypto.js": "./esm/cryptoNode.js",
"./crypto": "./esm/cryptoNode.js"
}
}
3 changes: 3 additions & 0 deletions src/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
3 changes: 3 additions & 0 deletions src/webcrypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
// from `crypto` to `cryptoNode`, which imports native module.
// Makes the utils un-importable in browsers without a bundler.
// Once node.js 18 is deprecated, we can just drop the import.
//
// Use full path so that Node.js can rewrite it to `cryptoNode.js`.
// @ts-ignore: `tsc` doesn't understand `@noble/ciphers/crypto` is a valid import.
import { randomBytes, getWebcryptoSubtle } from '@noble/ciphers/crypto';
import { Cipher, concatBytes } from './utils.js';
import { number } from './_assert.js';
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.esm.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"paths": {
"@noble/ciphers/crypto": ["src/crypto"]
},
"module": "es2020",
"module": "Node16",
"outDir": "esm",
"moduleResolution": "bundler"
"moduleResolution": "Node16"
},
"include": ["src"],
"exclude": ["node_modules", "lib"]
Expand Down

0 comments on commit 11df073

Please sign in to comment.