【发布时间】:2019-05-20 17:56:56
【问题描述】:
我在服务器上使用带有 NodeJS 的 Typescript。
作为服务器逻辑的一部分,我需要操作 .xlsx 和 .docx 文件,但它们不包含在 Typescript 编译输出中。 .xlsx 和 .docx 文件用作创建其他文件的模板。
这就是我的项目的样子:
package.json
package-lock.json
ormconfig.json
tsconfig.json
/src
/reports
--other-.ts-files
Router.ts
Report.xlsx //File that I want to be included in the Typescript compilation output
Report.docx //File that I want to be included in the Typescript compilation output
如何在 Typescript 编译输出中包含 .xlsx 和 .docx 文件? 我需要在 tsconfig.json 文件中添加什么?
【问题讨论】:
-
我只希望 Typescript 编译器将它们包含在最终输出中。
-
但是,Typescript 不能包含 json 文件吗?
-
我不想导入文件。我只想保留文件,以便以后我可以通过使用它的路径使用库来操作它,但我不能,因为该文件不包含在 Typescript 编译输出中。
标签: typescript xlsx docx