[Solved] Cannot use latest SDK webpack in browser

I have been trying to use the browser js file (under the /dist folder in the SDK distribution) without luck. I downloaded the latest SDK, switched to the develop branch, built the webpack js file with npm run build but I could not get it to work.

No Ae or Aepp object seems available, also the console shows the following message:

crypto.js:33 Uncaught TypeError: Cannot read property 'ModeOfOperation' of undefined
        at Object.<anonymous> (crypto.js:33)
        at Object.<anonymous> (crypto.js:596)
        at n (bootstrap:19)
        at Object.<anonymous> (index.js:18)
        at n (bootstrap:19)
        at bootstrap:83
        at bootstrap:83
        at universalModuleDefinition:9
        at universalModuleDefinition:1

any help on this?
thanks.

1 Like

SDK has some dependencies that should be satisfied manually if SDK used without a build system. These dependencies must be satisfied automatically if you are using a build system (like Webpack or so) to build your web application.

You can build SDK that contains all dependencies by omitting of these lines of webpack config: https://github.com/aeternity/aepp-sdk-js/blob/b8f4fde3845ffbfe560bc81cef230a3deff519c6/webpack.config.js#L41-L49

3 Likes

Also am preparing new release 4.0.1 which will include new bundle file for using sdk through <script> tag.

1 Like

Great guys, patching the webpack config file seems to work as a workaround. Thanks!!!

1 Like

@hernandp Latest sdk version contain bundle with all deps https://unpkg.com/@aeternity/[email protected]/dist/aepp-sdk.browser-script.js

3 Likes