UNPKG

1.97 kBMarkdownView Raw
1# web3.js-browser
2[![jsdelivr](https://data.jsdelivr.com/v1/package/gh/andy0130tw/web3.js-browser/badge)](https://www.jsdelivr.com/package/gh/andy0130tw/web3.js-browser) \
3[![NPM](https://nodei.co/npm/web3.js-browser.png)](https://nodei.co/npm/web3.js-browser/)
4
5An intent to bundle a standalone version of web3.js for browsers, because web3.js SHOULD have a 2.x minified version for dApp developers.
6
7FYI: [web3.js#2623](https://github.com/ethereum/web3.js/issues/2623).
8
9# tl;dr
10
11* Download scripts in [build/](build) directory, or
12* Use it as a typical [npm module](https://www.npmjs.com/package/web3.js-browser), or
13* Import from CDN services like [jsDelivr](https://cdn.jsdelivr.net/gh/andy0130tw/web3.js-browser@0.2.0/build/web3.min.js).
14
15It is recommended to **pin** this bundle **to some specific version**, because web3.js varies dramatically across versions. You may waste much time debugging on some inconsistencies like me if used naively.
16
17# Build
18
19```bash
20git submodule init
21git submodule update
22
23# configure web3
24cd web3.js
25npm install
26npm run build # build web3 packages; we only need *.esm.js
27cd ..
28
29# build web3.js
30yarn
31npm run build
32```
33
34# Web3.js caveats
35
36The author was not careful enough to mistake v2.0.0-alpha for v2.0.0-alpha.1. To reduce confusion, this project deserves its own semantics versioning. See the releases page for details.
37
38## `Scrypt`
39This bundle current follows **v2.0.0-alpha.1**. Current implementation deprecates `scrypt` dependency in higher versions of Node.js, likely because its lack of security. If you see the following message, it can be safely ignored.
40
41```
42WARNING in ./web3.js/packages/web3-eth-accounts/dist/web3-eth-accounts.esm.js
43Module not found: Error: Can't resolve 'scrypt' in '/.../web3.js-browser/web3.js/packages/web3-eth-accounts/dist'
44```
45
46Please refer to [this commit](https://github.com/ethereum/web3.js/commit/5ec0eacc2ef653fe14f6395e7e1a2f2a5ec85c01#diff-c8c34ba606a9444fb16f52d7f80a306e) for details.