我应该在ASP.NET MVC项目中的package.json中使用devDependencies还是依赖项?

时间:2017-08-19 15:09:35

标签: visual-studio angular npm gulp

我正在创建ASP.NET Core 2.0 MVC application并与Angular 4集成。我创建了一个名为package.json的NPM包配置文件,并保存在根文件夹中。

我不想使用 angular-cli ,而是使用 Gulp 来编译和捆绑角度文件。

Visual Studio 2017安装软件包时出现错误。我应该在devDependencies文件中使用dependencies还是package.json

{ "version": "1.0.0", "name": "asp.net", "private": true, "dependencies": { "@angular/animations": "^4.2.4", "@angular/common": "^4.2.4", "@angular/compiler": "^4.2.4", "@angular/core": "^4.2.4", "@angular/forms": "^4.2.4", "@angular/http": "^4.2.4", "@angular/platform-browser": "^4.2.4", "@angular/platform-browser-dynamic": "^4.2.4", "@angular/router": "^4.2.4", "core-js": "^2.4.1", "gulp": "^3.9.1", "gulp-babel": "7.0.0", "gulp-concat": "2.6.1", "gulp-sourcemaps": "2.6.1", "gulp-typescript": "3.2.1", "minimatch": "3.0.4", "minimist": "1.2.0", "rimraf": "2.6.1", "require-dir": "0.3.2", "rxjs": "^5.4.2", "systemjs-builder": "0.16.9", "zone.js": "^0.8.14", "typescript": "2.4.2" }, "devDependencies": { "@angular/animations": "^4.2.4", "@angular/common": "^4.2.4", "@angular/compiler": "^4.2.4", "@angular/core": "^4.2.4", "@angular/forms": "^4.2.4", "@angular/http": "^4.2.4", "@angular/platform-browser": "^4.2.4", "@angular/platform-browser-dynamic": "^4.2.4", "@angular/router": "^4.2.4", "core-js": "^2.4.1", "gulp": "^3.9.1", "gulp-babel": "7.0.0", "gulp-concat": "2.6.1", "gulp-sourcemaps": "2.6.1", "gulp-typescript": "3.2.1", "minimatch": "3.0.4", "minimist": "1.2.0", "rimraf": "2.6.1", "require-dir": "0.3.2", "rxjs": "^5.4.2", "systemjs-builder": "0.16.9", "zone.js": "^0.8.14", "typescript": "2.4.2" } }

1 个答案:

答案 0 :(得分:3)

简短的回答是,您应该同时使用要捆绑的UI库的依赖项,以及允许您开发应用程序的devDependencies。

这篇文章中有一个很棒的解释:https://stackoverflow.com/a/22004559/1303897