Lowcoder Documentation
Ask or search…

Use third-party libraries in Apps

Every developer learns one of the most important principles of software engineering early in their career: DRY (Don’t Repeat Yourself). Using third-party libraries can save you time as you do not need to develop the functionality that the library provides. Lowcoder provides some built-in third-party libraries for common uses, and you can manually import other libraries on demand.

Built-in libraries

Lowcoder provides some JavaScript built-in libraries for use.
9.0.0(Support v1/v3/v4/v5)

Manually import third-party libraries

Lowcoder supports setting up preloaded JavaScript and libraries which either can be imported for individual apps, or for the whole workspace.
  • App-level libraries **** get loaded only in the app where they were defined. This means that a library imported to app A is not loaded for app B. The reverse is also true. A library imported for app B is not available to app A unless it is explicitly imported to app A as well.
  • Workspace-level libraries **** will be loaded when you open any application in your workspace. All the apps can access those libraries. There can be a certain impact on app performance, especially when you have complex JavaScript functions that aren't being used in every app.
Tips you should know before setting up libraries:
  • External libraries are loaded and run in the browser.
  • NodeJS-only libraries are not supported now.
  • URLs of external libraries need to support cross-domain.
  • The export of the library must be set directly on the window object, global variables like var xxx = xxx do not take effect.
  • The external libraries run in a restricted sandbox environment and the following global variables are not available:
Now let's take cowsay as an example and import it at the app level and the workspace level.

At the app level

Navigate to the settings page and then click the plus sign + under the JavaScript library tab. Paste the cowsay link and click Add New. You can also click the download icon to quickly download any recommended JS library.
Create a JS query and insert code.
You can obtain the same result by calling the cowsay.say() method in the value of the text component.
Note that the cowsay library is imported at app-level and you can not use it in any other app within your workspace.
You should see something similar to the image below after successfully importing the cowsay library. Note that you see what global variable you can use to access the library.

At the workspace level

Go to Lowcoder's homepage, select Settings > Advanced, and then click Add under the JavaScript library tab. Paste the link of the third-party JS library and click Add New to add it to your workspace. You can also click the download icon to quickly add any recommended JS library. The installed libraries are accessible from any app within your workspace.