<p>I found that using WASM comes with a lot of headaches ...</p>
<p>There is a non-wasm version of the same lib which I have installed and have been using. Here is my github repo with an example:</p>
<p><a href="https://github.com/dynamicstrategies/cardano-wallet-connector" rel="nofollow noreferrer">https://github.com/dynamicstrategies/cardano-wallet-connector</a></p>
<p>The non-wasm npm to install is here:</p>
<p><a href="https://www.npmjs.com/package/@emurgo/cardano-serialization-lib-asmjs" rel="nofollow noreferrer">https://www.npmjs.com/package/@emurgo/cardano-serialization-lib-asmjs</a></p>

CC BY-SA 4.0
2022-02-15T21:04:16.343Z
2022-02-15T21:04:16.343Z
D S
<p>Trying a few different examples out there and I am getting the error:</p>
<p>The requested module '/node_modules/@emurgo/cardano-serialization-lib-browser/cardano_serialization_lib_bg.wasm?import' does not provide an export named '__wbg_address_free'
Using this project:</p>
<p><a href="https://github.com/HarmonicPool/cardano-wallet-interface" rel="nofollow noreferrer">https://github.com/HarmonicPool/cardano-wallet-interface</a></p>
<p>Loader:</p>
<pre class="lang-javascript prettyprint-override"><code>
let private_wasm = undefined;
/**
 * *.wasm module can only be imported asyncronously
 * Loader class allow to load the cardano serializaton lib once and make it aviable every time
 */
 class Loader {

  
    // always call this method to be shure the wasm has been loaded;
    static async load() {
  
      //load once
      if ( private_wasm !== undefined ) return;
  
      /**
       * @private
       */
       private_wasm = await import(
        &quot;@emurgo/cardano-serialization-lib-browser/cardano_serialization_lib&quot;
      );
    }
  
    static get Cardano() {
      return private_wasm;
    }
  }
    
  module.exports = Loader;
</code></pre>
<p>Any ideas why? The loader looks same as every example I've seen out there.</p>

CC BY-SA 4.0
2022-01-08T00:15:50.030Z
If you are using nodeJs then you are NOT in the browser, right? you are in the backend? if thats the case you might consider NOT using the browser library and in that case there is no need of a Loader. I have used just loader in ES6 versions, and always is a little of a mess to get it up working, because you have to configure so many things like Webpack etc.. package.json ... I would recommend to include a little bit more of the configuration of your project. Also check the webpack.config of the project you are using as a template as well as package.json and of course node version.
Alicia Basilio
CC BY-SA 4.0
2022-01-08T17:09:45.280Z
I was trying to do it with Vue + Vite and I think something about importing it with Vite is what wasn't working out, I thought I was follow the Vite docs but obvs not! Switched to Vue and Webpack and it's working now.
radflipper
CC BY-SA 4.0
2022-03-04T20:00:40.967Z
Thanks you for your answer you are amazing using WASM was horrible this implementation is much better
Kevin Mijares
<wallet><nami-wallet><cardano-serialization-lib>
Error loading cardano-serialization-lib
# Error loading cardano-serialization-lib

(Asked by: username_0 on 2022-01-07)

Trying a few different examples out there and I am getting the error:
The requested module '/node_modules/@emurgo/cardano-serialization-lib-browser/cardano_serialization_lib_bg.wasm?import' does not provide an export named '__wbg_address_free'
Using this project:
https://github.com/HarmonicPool/cardano-wallet-interface
Loader:

let private_wasm = undefined;
/**
 * *.wasm module can only be imported asyncronously
 * Loader class allow to load the cardano serializaton lib once and make it aviable every time
 */
 class Loader {

  
    // always call this method to be shure the wasm has been loaded;
    static async load() {
  
      //load once
      if ( private_wasm !== undefined ) return;
  
      /**
       * @private
       */
       private_wasm = await import(
        "@emurgo/cardano-serialization-lib-browser/cardano_serialization_lib"
      );
    }
  
    static get Cardano() {
      return private_wasm;
    }
  }
    
  module.exports = Loader;

Any ideas why? The loader looks same as every example I've seen out there.

**Tags:** wallet, nami-wallet, cardano-serialization-lib
> **Comments:**
> **username_1**: If you are using nodeJs then you are NOT in the browser, right? you are in the backend? if thats the case you might consider NOT using the browser library and in that case there is no need of a Loader. I have used just loader in ES6 versions, and always is a little of a mess to get it up working, because you have to configure so many things like Webpack etc.. package.json ... I would recommend to include a little bit more of the configuration of your project. Also check the webpack.config of the project you are using as a template as well as package.json and of course node version.  
> **username_0**: I was trying to do it with Vue + Vite and I think something about importing it with Vite is what wasn't working out, I thought I was follow the Vite docs but obvs not! Switched to Vue and Webpack and it's working now.  
> **username_2**: Thanks you for your answer you are amazing using WASM was horrible this implementation is much better  

---

## 1 answers

### Answer by username_3 on 2022-02-15. Score: 2

I found that using WASM comes with a lot of headaches ...

There is a non-wasm version of the same lib which I have installed and have been using. Here is my github repo with an example:

<https://github.com/dynamicstrategies/cardano-wallet-connector>

The non-wasm npm to install is here:

<https://www.npmjs.com/package/@emurgo/cardano-serialization-lib-asmjs>


---

