How do you ‘require’ external modules in Electron with the new, secure, default settings?

I have an Electron app from several years back that I’m trying to update to use the latest versions of Node, Electron, and all the external modules I’ve used. It’s been a very frustrating experience as all the paradigms have shifted, especially around security, but I want to keep my app using the secure settings if possible.

Safely sandbox and execute user submitted JavaScript?

I would like to have the ability to let users submit arbitrary JavaScript code, which is then sent to a Node.JS server and safely executed before the output is sent back to multiple clients (as JSON). The eval function comes to mind, but I know this has multiple security concerns (the user submitted code would be able to access Node’s File API, etc). I have seen some projects like Microsoft Web Sandbox and Google Caja which allow execution of sanitized markup and script (for embedding third-party ads on websites), but it seems that these are client-side tools and I’m not sure if they can be safely used within Node.