Thank you @PitaJ for pointing me in the right direction. I adapted my code to the link you sent me.
(function (factory) {
if (typeof module === 'object' && module.exports) {
factory(require.main.require('benchpressjs'));
} else {
require(['benchpress'], factory);
}
}(function (Benchpress) {
const logger = (data) => {
console.log('Logger helper', data);
return '';
};
const customHelpers = {
register,
logger,
};
function register() {
Object.keys(customHelpers).forEach(function (helperName) {
Benchpress.registerHelper(helperName, customHelpers[helperName]);
});
}
register();
if (typeof module === 'object' && module.exports) {
module.exports = customHelpers;
}
}));
Just by doing this made it work client side. But then it stopped working server side. That was easily fixed though by running helpers.register in my library file.
const helpers = require('./lib/helpers');
helpers.register();
Hope this helpes someone!