I am trying to include stellar-sdk.js (for use on the browser side) like this:

import * as stellarModule  from './stellar-sdk.js';

The file stellar-sdk.js is present. However, I get this error, when trying to import it in the main js file:

stellar-sdk.js:14400 Uncaught TypeError: Cannot read property 'TYPED_ARRAY_SUPPORT' of undefined
    at Object.<anonymous> (stellar-sdk.js:14400)
    at Object.exports.byteLength (stellar-sdk.js:16148)
    at __webpack_require__ (stellar-sdk.js:562)
    at Object.<anonymous> (stellar-sdk.js:41366)
    at __webpack_require__ (stellar-sdk.js:562)
    at Object.exports.default (stellar-sdk.js:28883)
    at __webpack_require__ (stellar-sdk.js:562)
    at Object.<anonymous> (stellar-sdk.js:28833)
    at __webpack_require__ (stellar-sdk.js:562)
    at Object.<anonymous> (stellar-sdk.js:26425)
    at __webpack_require__ (stellar-sdk.js:562)
    at Object.<anonymous> (stellar-sdk.js:26409)
    at __webpack_require__ (stellar-sdk.js:562)
    at Object._interopRequireWildcard (stellar-sdk.js:26367)
    at __webpack_require__ (stellar-sdk.js:562)
    at Object._interopRequireWildcard (stellar-sdk.js:26284)
  • What browser and SDK version are you using? – Bartek Nowotarski May 1 '18 at 11:31

Stellar sdk browser side javascript is pulled from here: https://github.com/stellar/bower-js-stellar-sdk

Chrome browser Version 65.0.3325.181 (Official Build) (64-bit) .

However, I got it to work for now by importing the stellar sdk javascript in the html file. I am not sure how I will package and ship my javascript module without solving importing stellar-sdk.js from another js file.
Ideally , I could refer to the stellar-sdk.js from my other js file, by importing it somehow, like this:

import * as stellarModule from './stellar-sdk.js';

  • To clarify: when including in the html file like this: <script src="./public/javascriptstellar-sdk.js" ></script> it works fine. But I cannot include in another js file. – GeorgeV May 1 '18 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.