Skip to Content
avatar image
Former Member

Use external libraries in XS Engine

I'm trying to use third party Javascript libraries for my projects in the XS Engine. Let's assume I'm writing a script that has two direct dependencies:

my-app.js
 |-- dependency-a.js
  |-- dependency-b.js
        |-- subdependency-b1.js
        |-- subdependency-b2.js

How can I make dependency-a.js and dependency-b.js (including their dependencies) available for my-app.js in the XS Engine?

Does the XS Engine support some kind of package management / module system (like CommonJS)?

Currently the only method I found for one Javascript file to depend on another is to make the dependency an *.xsjslib file and import it. This isn't a feasible solution in my scenario, because:

1. Pretty much all server-side libraries I want to use are modules based on CommonJS (mainly written for Node.js), and would have to be adapted

2. Not all libraries I use have been validated by JSLint, so HANA doesn't actually allow me to activate them till they are (is there a way to disable JSLint?)

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Jun 24, 2014 at 12:27 PM

    In order to use them in server side JavaScript they must have the file extension XSJSLIB and be imported. They also must pass the server side JSLint checks for activation. The client side JSLint checks, which are more strict, can be ignored or disabled at the project level.

    Add comment
    10|10000 characters needed characters exceeded