Skip to content

How did you bundle make-tls-client.ts for use in the browser? #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
guest271314 opened this issue Apr 6, 2025 · 1 comment
Open

Comments

@guest271314
Copy link

bun build throws at importing createDecipheriv

bun build src/make-tls-client.ts
4 | import { createDecipheriv } from 'crypto'
             ^
error: Browser polyfill for module "node:crypto" doesn't have a matching export named "createDecipheriv"
    at /home/user/tls/src/crypto/aes-cbc.ts:4:10

4 | import { createDecipheriv } from 'crypto'
             ^
note: Bun's bundler defaults to browser builds instead of node or bun builds. If you want to use node or bun builds, you can set the target to "node" or "bun" in the transpiler options.
   at /home/user/tls/src/crypto/aes-cbc.ts:4:10
@guest271314
Copy link
Author

To get this working at all in the browser I had to get rid of createDecipheriv , which can't be polyfilled because node:crypto can't be polyfilled in it's entirety.

I don't think onApplicationData(data) {...} is ever executed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant