In #1238 / #1253, all the template engine dependencies were correctly marked as optional peerDependencies. Optional peer dependencies are not installed by default.
This matches what the documentation suggests, which tells you to install a template engine of your choice along with @nest-modules/mailer.
However, the template engines are additionally marked as optionalDependencies, which are installed by default. The only difference between regular dependencies and optional dependencies is that installation failures of an optional dependency are simply ignored.
Installation of optional dependencies can be skipped with --omit=optional, but that is only available as a global switch. But some packages include native binary dependencies in their optional dependencies (with the expectation that only the one matching your platform will successfully install), for example css-inline. So simply omitting all optional dependencies is not always an option.
Since the documentation already states that you must install the template engine that you actually use separately, the solution is to simply remove all template engines from optionalDependencies and only keep them as optional peerDependencies.
Workaround
If you can't use --omit=optional, add this to your package.json overrides section (leaving out the template engine that you actually use):
"overrides": {
"@nestjs-modules/mailer": {
"ejs": "npm:npm-empty-package@1.0.0",
"pug": "npm:npm-empty-package@1.0.0",
"mjml": "npm:npm-empty-package@1.0.0",
"liquidjs": "npm:npm-empty-package@1.0.0",
"nunjucks": "npm:npm-empty-package@1.0.0",
"handlebars": "npm:npm-empty-package@1.0.0",
"preview-email": "npm:npm-empty-package@1.0.0",
"@types/ejs": "npm:npm-empty-package@1.0.0",
"@types/mjml": "npm:npm-empty-package@1.0.0",
"@types/pug": "npm:npm-empty-package@1.0.0"
}
}
In #1238 / #1253, all the template engine dependencies were correctly marked as
optionalpeerDependencies. Optional peer dependencies are not installed by default.This matches what the documentation suggests, which tells you to install a template engine of your choice along with
@nest-modules/mailer.However, the template engines are additionally marked as
optionalDependencies, which are installed by default. The only difference between regular dependencies and optional dependencies is that installation failures of an optional dependency are simply ignored.Installation of optional dependencies can be skipped with
--omit=optional, but that is only available as a global switch. But some packages include native binary dependencies in their optional dependencies (with the expectation that only the one matching your platform will successfully install), for example css-inline. So simply omitting all optional dependencies is not always an option.Since the documentation already states that you must install the template engine that you actually use separately, the solution is to simply remove all template engines from
optionalDependenciesand only keep them as optionalpeerDependencies.Workaround
If you can't use
--omit=optional, add this to yourpackage.jsonoverrides section (leaving out the template engine that you actually use):