andywer / andywer/isomorphic-crypto

Reduce size for browser

Aperta
#1 3 commenti 1 reazione 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
JavaScript
Stelle
12
Fork
0
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.