[英]How to add a PDF in TypeScript build folder?
I have the following Firebase function which uses nodemailer to send an email with attachment.我有以下 Firebase function 它使用 nodemailer 发送带有附件的 email。
await nodemailer.createTransport(transport).sendMail({
from: from,
to: studentDto.email,
subject: subject,
html: Mail.createInvoice(studentDto, itemDto),
attachments: [{filename: 'file.pdf', path: './assets/file.pdf'}],
});
The PDF is at src/assets/file.pdf
. PDF 位于src/assets/file.pdf
。 When I run npm run build
the folder lib
is created but assets/file.pdf
is not included.当我运行npm run build
时,会创建文件夹lib
,但assets/file.pdf
不包括在内。
tsconfig.json tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"noImplicitReturns": true,
"noUnusedLocals": true,
"outDir": "lib",
"sourceMap": true,
"strict": true,
"target": "es2017"
},
"compileOnSave": true,
"include": [
"src"
]
}
How can file.pdf
be included in the build?如何将file.pdf
包含在构建中?
TSC does not include any assets in the build. TSC 在构建中不包含任何资产。
I uploaded the file to Firebase Storage.我将文件上传到 Firebase 存储。 There I could copy the public url and use it.在那里我可以复制公共 url 并使用它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.