2

How I can use in a NativeScript project the js-stellar-sdk JavaScript library: https://github.com/stellar/js-stellar-sdk

I have a service in the Angular project sharing with a NativeScript project.

In the Angular project, was easy to use it. I have just to add it to the Angular.js

"architect": {
    "build": {
        "scripts": [
            "./node_modules/stellar-sdk/dist/stellar-sdk.min.js"
        ]

And declare it in the typings.d.ts file:

declare var StellarSdk: any;

And use it in the code:

import * as StellarSdk from 'stellar-sdk/dist/stellar-sdk.min.js';
declare const StellarSdk: any;

But when I am trying to run the NativeScript project, is not able to find the library:

JS: ERROR Error: Uncaught (in promise): ReferenceError: StellarSdk is not defined
JS: ReferenceError: StellarSdk is not defined
Alex Bean
  • 493
  • 7
  • 19

0 Answers0