Skip to content

Latest commit

 

History

History

browser-esbuild

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Bundle ipfs-provider, js-ipfs-http-client and js-ipfs with esbuild

In this example, you will find a boilerplate you can use to guide yourself into bundling everything with esbuild (similar to browserify), so that you can use it in your own web app for a robust IPFS fallback.

Run this example

Make sure ipfs-provider is built first, as this demo uses local version of ipfs-provider at file:../../

$ npm ci
$ npm start

Now open your browser at http://localhost:8888

Fallback explanation

After loading http://localhost:8888 you should see something similar to the following:

Let's unpack what happened in the above example:

  1. 🔴 test request to local API (/ip4/127.0.0.1/tcp/5001) was blocked due to CORS protection
  2. 🔴 /api/v0/ on the same Origin as the page did not exist
  3. 🔴 explicitly defined remote API was offline (http://dev.local:8080)
  4. 💚 final fallback worked: spawning embedded js-ipfs was executed successfully 🚀✨