Adding Modules
Note: Make sure you
await
any Promises returned by external module calls to ensure they complete.
The Napkin runtime comes pre-installed with thousands of the most downloaded packages from NPM. To use any of these modules in your functions, you must first add them via the "Modules" tab in the Napkin UI. This is so that that Napkin knows which version of the module to import at runtime.
Importing Modules
Napkin supports both CommonJS and ES6 module syntax, so both of the following work:
import _ from "lodash";
// or
const _ = require("lodash");
Requesting New Modules
Can't find the module you're looking for in the Napkin UI? You can request the
addition of new modules on the Napkin Discord server in the #module-requests
channel.