Skip to content

Commit

Permalink
Merge pull request #38 from galacticcouncil/nohaapav-patch-1
Browse files Browse the repository at this point in the history
Update TROUBLESHOOTING.md
  • Loading branch information
nohaapav authored Mar 31, 2024
2 parents b014a1c + 89fc311 commit d9998f5
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions packages/sdk/TROUBLESHOOTING.md
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/",
},
],
}),
],
};
});
```

0 comments on commit d9998f5

Please sign in to comment.