I'd like to add on-the-fly parsing capabilities to the Node-RED function node using Uglify-JS. I'm in the file "80-function.html", but for some reason, I can't get a reference to UglifyJS. I'm trying to instantiate it by simply calling
var UglifyJS = require('uglify-js');
...but it returns null. I've made sure that it is installed under /usr/lib/node_modules/node-red/node_modules/uglify-js/
Where should the instantiation of UglifyJS go? I can't find any examples of "require" being used in the html part of the nodes. My code structure is below:
RED.nodes.registerType('function',{
...
oneditprepare: function() {
...
var currentEditor = this.editor;
this.editor.on("change", function(e) {
var currentScript = currentEditor.getValue();
//this is where I'd like to parse my script using Uglify
Thanks!