Skip to content

Latest commit

 

History

History
37 lines (24 loc) · 912 Bytes

File metadata and controls

37 lines (24 loc) · 912 Bytes

Nimiq Web Client in Webpack

The Nimiq Web Client ships with support for Webpack.


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

module.exports = {
  experiments: { // [!code ++]
    asyncWebAssembly: true, // [!code ++]
  }, // [!code ++]
}

Now you are ready to go!

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()

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