I understand that karma-typescript uses browser-resolve to also use the field, however, it does not seem to work:
Chrome Headless 100.0.4889.0 (Linux x86_64) ERROR
Uncaught Error: node crypto api unavailable
at src/lib/crypto_subtle.ts:9:1 <- src/lib/crypto_subtle.js:14:5
Error: node crypto api unavailable
at Object.global.wrappers./home/fryorcraken/src/status-im/js-waku/src/lib/crypto_subtle.ts.crypto (src/lib/crypto_subtle.ts:9:7 <- src/lib/crypto_subtle.js:14:11)
at require (node_modules/karma-typescript/dist/client/commonjs.js:17:25)
at node_modules/karma-typescript/dist/client/commonjs.js:18:24
at Object.global.wrappers./home/fryorcraken/src/status-im/js-waku/src/lib/crypto.ts../crypto_subtle (src/lib/crypto.ts:3:18 <- src/lib/crypto.js:6:25)
at require (node_modules/karma-typescript/dist/client/commonjs.js:17:25)
at node_modules/karma-typescript/dist/client/commonjs.js:18:24
at Object.global.wrappers./home/fryorcraken/src/status-im/js-waku/src/lib/enr/v4.ts.js-sha3 (src/lib/enr/v4.ts:9:22 <- src/lib/enr/v4.js:27:18)
at require (node_modules/karma-typescript/dist/client/commonjs.js:17:25)
at node_modules/karma-typescript/dist/client/commonjs.js:18:24
at Object.global.wrappers./home/fryorcraken/src/status-im/js-waku/src/lib/enr/index.ts../v4 (src/lib/enr/index.ts:3:1 <- src/lib/enr/index.js:28:31)
The crypto_subtle.js file is used instead of crypto_subtle_browser.js.
Do I need to enable browser-resolve?
To Reproduce
git clone https://github.com/status-im/js-waku.git
git checkout origin/browser-resolve
npm i
npm run test:karma
I am trying to clean up the use of node vs browser API in my repo by using the
browser
field in mypackage.json
:I understand that
karma-typescript
usesbrowser-resolve
to also use the field, however, it does not seem to work:The
crypto_subtle.js
file is used instead ofcrypto_subtle_browser.js
.Do I need to enable
browser-resolve
?To Reproduce