Using external Node libraries
Last updated
Was this helpful?
Last updated
Was this helpful?
External libraries enhance the functionality of your UI Bakery app by allowing you to use additional JavaScript code. You can take advantage of a vast number of JavaScript libraries to bring date manipulation, data parsing, and much more into your automations.
Go to the npm website and search for a package, for example XML parsing, to find the libraries you need.
Select a library from the search results to view its Details page.
Click on the Versions tab at the top.
It is recommended to use the most recent stable version listed.
Here, copy the package name and version number and paste them in the Packages tab of the Automations page in the following format:
"xml2js": "^0.6.2"
Libraries dependent on the fs
and child_process
modules are currently not supported.
After adding the package number and version, you simply need to use import
statements to include the library in your Automations. Below is an example of an xml2js library added to the Automation action:
require()
importsrequire()
imports are not supported in the Automations runtime. You should use the ES6 module import syntax instead.
For modules using CommonJS require, replace it with an ES6 import
statement.
Before:
const yaml = require('js-yaml');
After:
import yaml from 'js-yaml';