To use MomentJS in views/custom.ejs, what is the correct way (if any)?
Server side
routes/index etc we can easily use require(\'moment\');
require(\'moment\');
As of Node v12.8.3, it seems that you can pass require directly to EJS templates, i.e. this works:
require
const ejs = require('ejs') let renderedHTML = ejs.render(`<% const moment = require('moment') %>`, { require })