In the function node, customize the message sending mechanism, but require is not defined.
Details of how to load external modules for use in the Function Node are covered in the Node-RED Getting Started Guide here
There are 2 options
Adding the node to the functionGlobalContext
by editing the settings.js
file. e.g.
functionGlobalContext: {
osModule:require('os')
}
Then load it in the function node with
var os = global.get('osModule');
Enabling functionExternalModules
in settings.js
, this will enable the ability to configure external modules in the function node editor. This feature is new in the 1.3.x release.