From 89fc3119e238cd579141849f16db82da6f09d2d1 Mon Sep 17 00:00:00 2001 From: Pavol Noha Date: Sun, 31 Mar 2024 14:19:35 +0200 Subject: [PATCH] Update TROUBLESHOOTING.md --- packages/sdk/TROUBLESHOOTING.md | 69 +++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/packages/sdk/TROUBLESHOOTING.md b/packages/sdk/TROUBLESHOOTING.md index e69de29b..1d1a1258 100644 --- a/packages/sdk/TROUBLESHOOTING.md +++ b/packages/sdk/TROUBLESHOOTING.md @@ -0,0 +1,69 @@ +# Troubleshooting + +## Upgrade to v2.x + +To upgrade to **v2.x** version, make sure your application build is packaging hydradx wasm files correctly +in dist folder. See examples down below: + +### script + +Using script in package.json + +```json +{ + "scripts": { + "copy:wasm": "./node_modules/@galacticcouncil/sdk/**/*.wasm ./dist" + }, +} +``` + +### esbuild + +Using esbuild `esbuild-plugin-copy` plugin: + +```javascript +import { copy } from 'esbuild-plugin-copy'; + +const plugins = [ + copy({ + resolveFrom: 'cwd', + assets: { + from: ['./node_modules/@galacticcouncil/sdk/build/*.wasm'], + to: ['./dist'], + }, + }), +]; +``` + +### vite & rollup + +Using vite `viteStaticCopy` plugin to copy wasm files to `build` folder & optimizeDeps exclude config in order +to load wasms correctly for local dev. + +```javascript +import { viteStaticCopy } from "vite-plugin-static-copy"; + +export default defineConfig(({ mode }) => { + return { + build: { + target: "esnext", + outDir: "build", + }, + optimizeDeps: { + exclude: ["@galacticcouncil/sdk"], + }, + plugins: [ + wasm(), + mode === "production" && + viteStaticCopy({ + targets: [ + { + src: "node_modules/@galacticcouncil/sdk/**/*.wasm", + dest: "assets/", + }, + ], + }), + ], + }; +}); +```