You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bun add -D vite-plugin-top-level-await vite-plugin-wasm
47
41
```
48
42
49
43
:::
50
44
51
45
## Configuration
52
46
53
-
### Basic Vite Setup
47
+
The Nimiq Web Client includes a Vite plugin that automatically configures WebAssembly support and all required optimizations.
48
+
49
+
> [!TIP]
50
+
> View the [plugin source code](https://github.com/nimiq/core-rs-albatross/blob/main/web-client/dist/vite.js) for implementation details.
51
+
52
+
Update your `vite.config.ts`:
53
+
54
+
```ts [vite.config.ts]
55
+
importnimiqfrom'@nimiq/core/vite'// [!code ++]
56
+
import { defineConfig } from'vite'
57
+
58
+
exportdefaultdefineConfig({
59
+
plugins: [nimiq()], // [!code ++]
60
+
})
61
+
```
62
+
63
+
The plugin automatically configures:
64
+
- WebAssembly support with `vite-plugin-wasm`
65
+
- Worker configuration for WASM modules
66
+
- Build target optimizations (`esnext`)
67
+
- Dependency exclusions for `@nimiq/core`
68
+
69
+
<details>
70
+
<summary>Legacy Browser Support</summary>
71
+
72
+
Modern browsers (Chrome 89+, Firefox 89+, Safari 15+, Edge 89+) support top-level await natively. If you need to support older browsers, install `vite-plugin-top-level-await`:
0 commit comments