Today I Learned

Breaking change in NestJS mailer's API - pug templates

With this commit - ver. 1.6.0, it is required to specify leading characters: ./ in the template’s name. Otherwise, the mailer complains about the missing template:

Error: ENOENT: no such file or directory, open 'sendDocument.pug'
    at Object.openSync (fs.js:465:3)
    at Object.readFileSync (fs.js:368:35)
    at handleTemplateCache (/api/node_modules/pug/lib/index.js:245:37)
    at Object.exports.renderFile (/api/node_modules/pug/lib/index.js:458:10)
    at Object.exports.renderFile (/api/node_modules/pug/lib/index.js:448:21)

A sample correct name:

await this.mailer.sendMail({
  template: './sendDocument',
  // ...