Module importing/exporting with javascript

Jay Walker's icon

Is working with modules in js not possible in Max? I know Max uses ES5, but for some reason, when I import a function, I get jsobject as the posted output. Here is the simple example I want to prove:

//https://medium.com/@zachgavin/module-exports-and-loading-es5-to-es6-a33ac592989c
// add.js
var add = function (a,b) {
  return a + b;
};
module.exports = add;
// output.js
var add = require(‘./add.js’);
post(add(2,2)); // 4;

Instead of 4, I get jsobject 123983274987.