-
Notifications
You must be signed in to change notification settings - Fork 512
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: detail how to reference on a cdn (#2271)
- Loading branch information
Showing
2 changed files
with
10 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,15 @@ | |
|
||
For when you need to do more than just install `xrpl.js` for it to work (especially for React projects in the browser). | ||
|
||
### Using xrpl.js from a CDN | ||
|
||
You can avoid setting up your build system to handle `xrpl.js` by using a cdn version that is prebuilt for the browser. | ||
|
||
- unpkg `<script src="https://unpkg.com/[email protected]/build/xrpl-latest-min.js"></script>` | ||
- jsdelivr `<script src="https://cdn.jsdelivr.net/npm/[email protected]/build/xrpl-latest-min.js"></script>` | ||
|
||
Ensure that the full path is provided so the browser can find the sourcemaps. | ||
|
||
### Using xrpl.js with `create-react-app` | ||
|
||
To use `xrpl.js` with React, you need to install shims for core NodeJS modules. Starting with version 5, Webpack stopped including shims by default, so you must modify your Webpack configuration to add the shims you need. Either you can eject your config and modify it, or you can use a library such as `react-app-rewired`. The example below uses `react-app-rewired`. | ||
|