feat(deps): remove assert-browserify (#2389)

Use if statements and manually error throwing to save 20kb gzipped.

BREAKING CHANGE: If you were catching AssertionError you need to change to Error.
This commit is contained in:
Caleb Kniffen
2023-07-26 18:08:24 -05:00
parent 0050b2f75e
commit 328987a0a3
14 changed files with 77 additions and 50 deletions

View File

@@ -19,7 +19,6 @@ To use `xrpl.js` with React, you need to install shims for core NodeJS modules.
```shell
npm install --save-dev \
assert \
buffer \
crypto-browserify \
process \
@@ -42,7 +41,6 @@ To use `xrpl.js` with React, you need to install shims for core NodeJS modules.
module.exports = function override(config) {
const fallback = config.resolve.fallback || {};
Object.assign(fallback, {
assert: require.resolve("assert"),
crypto: require.resolve("crypto-browserify"),
stream: require.resolve("stream-browserify"),
ws: require.resolve("xrpl/dist/npm/client/WSWrapper"),
@@ -119,7 +117,7 @@ Similar to above, to get xrpl.js to work with Vite you need to set up a couple a
2. Copy these settings into your `vite.config.ts` file.
```
```javascript
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { NodeGlobalsPolyfillPlugin } from "@esbuild-plugins/node-globals-polyfill";
@@ -163,7 +161,7 @@ resolve: {
3. Install the config dependencies and xrpl (e.g. using this command)
```
```shell
npm install --save-dev @esbuild-plugins/node-globals-polyfill \
rollup-plugin-polyfill-node \
&& npm install