3

I'm trying to use this 3rd party library in my nuxtjs web app: cardano-wallet-interface

This library in turn has a dependency that contains a wasm file and I couldn't get it to load properly.

I've read that I'm supposed to provide the "experiments" property of webpack config. But I'm getting errors when I tried to change my nuxt.config.js to the following:

export default {
    ...
    build: {
        transpile: ['cardano-wallet-interface'],
        extend(config, { isClient }) {
            if (isClient) {
                config.experiments = {
                    asyncWebAssembly: true,
                    syncWebAssembly: true
                }
            }
        }
    }
}

I get the following error:

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.

I have also tried this older solution described here to no avail:

export default {
    ...
    build: {
        transpile: ['cardano-wallet-interface'],
        extend(config, { isClient }) {
            if (isClient) {
                config.module.rules.push({
                    test: /\.wasm$/,
                    loaders: ['wasm-loader']
                });
            }
        }
    }
}

How are we supposed to properly load wasm into our nuxt project?

using Nuxt 2.15.8 with Vue 2.6.14.

Nim
  • 39
  • 1

0 Answers0