【发布时间】:2017-07-31 13:22:38
【问题描述】:
我正在尝试使用 Visual Studio 作为我的 IDE,以使用 Angular 2 开发 ASP.NET MVC 5 SPA。
当我尝试构建项目时,问题就出现了。它在*.d.ts 文件中给了我很多错误。
我使用angular-cli 命令创建了项目:ng new project-name
这是解决方案资源管理器的样子:
如何消除这些错误?我在 Visual Studio Code 中使用 angular 2 没有任何问题
更新:
根据您的回答,我在tsconfig.json 文件中添加了以下内容,但似乎不起作用
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"es2016"
]
},
"exclude": [
"./node_modules",
"**/*.spec.ts"
]
}
【问题讨论】:
-
编辑您的
tsconfig.json以从编译中排除 node_modules 文件夹。 -
我试过了,但它并没有改变@jessehouwing
-
尝试在 Windows 资源管理器中隐藏
node_modules目录。 -
我已经做了,但它不起作用,我认为问题是使用 webpack @OmidKamangar 的原因
-
删除 tsconfig.json 中的
"strict": true为我消除了类似的错误。
标签: angular visual-studio-2015 asp.net-mvc-5 single-page-application node-modules