Skip to content

Nimiq Web Client in Webpack

The Nimiq Web Client ships with support for Webpack.


Installation

bash
npm install @nimiq/core@next
bash
yarn add @nimiq/core@next
bash
pnpm add @nimiq/core@next
bash
bun add @nimiq/core@next

Update your webpack.config.js to enable the asyncWebAssembly :

javascript
module.exports = {
  experiments: { 
    asyncWebAssembly: true, 
  }, 
}

Now you are ready to go!

js
const Nimiq = await import('@nimiq/core') // You need to use await import() to load the WebAssembly module

const config = new Nimiq.ClientConfiguration()
const client = await Nimiq.Client.create(config.build())

await client.waitForConsensusEstablished()
warning

You need to use await import() to load the WebAssembly module and also experiment in your config.

Contribute

You can help us improve this guide by contributing to the Nimiq Web Client documentation on GitHub. Simply click the Edit this page button at the bottom of the page to suggest changes.