JavaScript function: require is not defined

So I'm trying something with the JavaScript function block that has to use the 'require' keyword from javascript. But when I run it, it says ReferenceError: require is not defined.
My project absolutely needs this to work properly. Does anyone know how to fix it?

require is not part of JavaScript: database - What is this JavaScript "require"? - Stack Overflow