如何在基于 Angular2 angular-cli 的项目中包含明确输入的文件 [英] How to include definitely typed files in an Angular2 angular-cli based project
问题描述
这种情况的最佳实践是什么:
What is the best practice for this scenario:
我使用 angular-cli
(即使用 ng new
)创建了一个 Angular2 项目
I have created an Angular2 project using angular-cli
(i.e. using ng new
)
我想包含来自 确定类型
例如,我应该使用 typings 来安装类型吗?如何确保类型包含在 ng build
中?
For example, should I use typings to install the types? How do I make sure the types are included in the ng build
?
如果您的回答是我应该以某种方式破解 webpack
设置,请说明我将如何操作,因为我只有 angular-cli.json
文件
If you answer is that I should hack the webpack
settings somehow, please include how I would do that, since I only have the angular-cli.json
file
推荐答案
Angular-cli 使用 typescript 2.0,你只需要在 npm 上搜索打字机,说你想要 jquery 类型,安装它们:
Angular-cli uses typescript 2.0, you just need to search for the typings on npm, say you want jquery types, just install them:
npm install --save @types/jquery
就是这样.更多信息这里
这篇关于如何在基于 Angular2 angular-cli 的项目中包含明确输入的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!