-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from galacticcouncil/nohaapav-patch-1
Update TROUBLESHOOTING.md
- Loading branch information
Showing
1 changed file
with
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/", | ||
}, | ||
], | ||
}), | ||
], | ||
}; | ||
}); | ||
``` |