So I wanted to precompile ejs templates into a .js file

var compiled = ejs.compile(source);
fs.writeFileSync(target, 'myTemplateFunction = ' + compiled);

but that serilalizes into

function (locals){
   return fn.call(this, locals, filters, utils.escape);
}

what's the best way to pre-compile and write ejs templates into a .js file

ejs
Edit
Report