Bundle js-ipfs with Parcel.js
In this example, you will find a boilerplate application that connects to IPFS using JS-IPFS and is bundled with Parcel.js, so that you can follow it for creating Parcel.js bundled js-ipfs DApps.
- Start your IPFS daemon of choice e.g.
ipfs daemon
(optional if you do not want to serve the example over IPFS) - Open a new terminal
cd
into this folder- Run
npm install
npm start
- Open your browser at
http://localhost:1234
You should see the following:
- Clear the contents of
dist
if this is not the first time you are building e.g.rm -r dist
on a unix system npm run build
- The production build of the site is now in the
dist
folder - Add the folder to ipfs using your IPFS client of choice e.g.
ipfs add -r dist
The last hash output is the hash of the directory. This can be used to access this example served over IPFS and will be accessible by a public gateway:
https://ipfs.io/ipfs/<hash_of_directory>/