0

Where do I put common server-side JavaScript files used by most of my jobs? I do not want to get fancy and create a new Node module, I just need a place to put a couple of utility functions.

sebnukem
  • 8,143
  • 6
  • 38
  • 48

1 Answers1

0

A Node module is the only way that works I could find. I created a .js file (for instance utils.js) in the package folder where jobs/ and widgets/ are, and put all my common code for export:

module.export = {
  commonFunction: function () { ... },
   :
};

In my jobs, I import the common code I need with:

var utils = require('../../utils.js');

and use the exported properties offered by utils.

sebnukem
  • 8,143
  • 6
  • 38
  • 48