Using IPFS in SvelteKit with Vite
This document provides a guide for installing and running IPFS and OrbitDB with SvelteKit, including steps to reproduce the setup. It also mentions the need to install certain dependencies and provides instructions for building the required modules for the browser.
npm install.npm i ipfs-core.npm i process util.src/node-globals.js and save the required globals in it.npm i -D esbuild.npm run esbuild.import IPFS from 'src/modules/ipfs-core/ipfs-core.js'.npm run dev.npm run build.npm i @sveltejs/adapter-static.import adapter from '@sveltejs/adapter-static';
export default {
...
kit: {
...
adapter: adapter({ fallback: 'index.html' }),
...
},
...
};
npm run build.npx serve __sapper__/build.Note: In development mode, SvelteKit replaces globalThis.process.env.NODE_ENV with globalThis."development", which can cause issues. To prevent this, replace globalThis.process.env.NODE_ENV accordingly during the esbuild process.
This guide provides step-by-step instructions for installing and running IPFS and OrbitDB with SvelteKit. It covers the installation of dependencies, building IPFS-core for the browser, and configuring SvelteKit to work with IPFS and OrbitDB. The guide also includes instructions for running and building the app, as well as a note about preventing issues during development mode.