typescript - 配置nest-cli.json以将非TS文件包含到dist文件夹中
问题描述
我现在正在寻找几个小时的解决方案:
我正在使用nestJS 和nest mailer 创建电子邮件服务。一切正常,直到我想在我的邮件中包含一个模板。这些模板是位于 src/mail/templates 中的 hbs 文件,我知道在编译时嵌套不包含非 TS 文件:
我尝试配置nest-cli.json,添加以下链接:
"compilerOptions": {
"assets":["**/*.hbs"],
"watchAssets": true,
}
或者
"assets": [
{ "include": "**/*.hbs","watchAssets": true },
]
我的 nest-cli.json 文件如下所示:
{
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"assets": [
{ "include": "**/*.hbs","watchAssets": true },
]
}
}
但是没有任何东西被复制到 dist 文件夹中。所以我通过修改 package.json 来解决这个问题,添加了一个手动执行的 cp 命令,但我认为这不是正确的方法......有没有人想出在资产中包含一些非 TS 文件
PS:hbs 用于车把(邮件模板)
谢谢你的帮助 :)
解决方案
通过写入文件的整个路径来解决:
"assets": [
{ "include": "mail/sendbox/","watchAssets": true },
]
推荐阅读
- angular - 删除表时,Ionic SQLite 无法读取未定义的属性“executeSql”
- git - 如何拉取远程仓库仅在 Git 中获得最后一次提交?
- android - Android ViewModel Obserable 未观察到
- javascript - 如何从 JavaScript 中的 ASCII 字符生成随机字符串
- sql - 编写嵌套的 case 表达式
- python - python BeautifulSoup - 无法设置属性,试图替换标签值
- c - 为什么我不能使用 extern 关键字来初始化 extern 变量?
- ios - 如何在 ios 的 UIScrollView 中添加动态标签?
- python - 我如何处理玩家生命?
- node.js - 在 Sequelize 的多对多关联中包含中间表