Importing js libraries

Hi, I can't seem to get my library import working. I've added the URL to the scripts tab, are there any additional steps? When I try to import the library in my JS query, it complains that "import declarations may only appear at top level of a module"

Hey @zewen!

How are you referencing the library in your script? You should be able to use the PDFLib variable immediately:

Thanks! That worked, for future reference, how do I know what the imported module will be named? in this case, PDFLib

It depends a bit on the library, sometimes it can be apparent from the docs, especially if they reference the UMD version specifically. You can also try using Object.keys(window) after importing the library and refreshing the page. The newly imported variables should appear near the bottom of the resulting array: