我已经按照在线教程说我必须在.angular-cli.json文件中设置outDir.当我运行build build时,这会将编译的代码放在app.js文件夹中指定的正确目录中.问题是我无法在任何地方找到该文件.教程链接
解决方案已完成并且没有错误,我现在要做的就是将Angular连接到我拥有的后端并在localhost:3000上运行它.到目前为止,我只在tsconfig.json文件中找到了outdir.当我运行编译器时,文件最终会出现在默认的dist文件夹中.
Vik*_*kas 11
您指的教程是使用Angular 2,最新版本的Angular是6
将使用角度为6以上的CLI项目 angular.json而不是.angular-cli.json用于构建和项目配置.
每个CLI工作空间都有项目,每个项目都有目标,每个目标都可以有配置.文档
如果你想生成的构件将被存储在自定义位置从修改输出路径"outputPath": "dist/ng6",,以"outputPath": "dist/yourcustomlocation",在build目标
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"ng6": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/ng6",**<----/modify this**
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets":
Run Code Online (Sandbox Code Playgroud)
此外,该教程使用HttpModule它被废弃了,你应该使用HttpClientModule代替
| 归档时间: |
|
| 查看次数: |
5217 次 |
| 最近记录: |