For this example, I will use the glmatrix library, a collection of Vectors, Matrices, and associated linear algebra operations. These types of operations can be used for more than just graphics so they live in their own library. The glmatrix library is provided in a "min" format. Essentially one free of whitespace and newline characters and in one file.
So, the library I am importing is the glmatrixmin.js library which can be downloaded from the "dist" directory within the project github page: https://github.com/toji/gl-matrix/tree/master/dist.
First, you'll need to import the library into your project. With Visual Builder, you can import resources at each of the levels, App, Flow, and Page and that resource will be accessible via that path. To import the file, right click on the project App, Flow, or Page node and select Import Resource.
The resource needs to be uploaded as a zip file. So compress the glmatrixmin.js into a zip and select it from your files system in the Import Resources dialog. The dialog will show the import location. Remember this as this is how we reference the file later.
Now the file is imported, you can see it in your code view under the Resources folder of the "main" Flow within which it was imported.
Now, we can write some custom code in our PageModule and reference the file to load it into our module. To do that we use a define statement, which provides the path to the file and the alias with which we will refer to the imported library in our code.
See the below code example, for the define statement and usage. The full path to the file is used combining the import location with the flow name and resources directory. Note, the .js file extension is not necessary. Also, note the alias "glmatrix" is used to reference the objects and functions within the library.