andywer / andywer/isomorphic-crypto

Reduce size for browser

Open
#1 3 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
12
Forks
0
PR merge metrics
No merged PRs in 30d

Description

1. You should use [Size Limit](https://github.com/ai/size-limit). In this case it will show that browser version will be about 100 KB. In real usage, webpack will find `require('crypto')` and will insert own polyfill even if you already have different `crypto-browserify` polyfill.
2. `if (process.browser)` is a bad way to detect browsers. It inserts 1 KB polyfill. Better to use `"browser"` key in `package.json`. Here is example from `nanoid`: https://github.com/ai/nanoid/blob/116c48d1a2f46ca80f87cd560de9fdc75c454b4c/package.json#L14-L16

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.