相关疑难解决方法(0)

Angular 构建找不到具有相对路径的模块(在 azure dev ops 上)

在 Azure Dev Ops Pipelines 上构建中型 Angular 7 项目时遇到问题。所以我创建了一个最小的项目来重现这个问题。

使用 Angular CLI (7.2.4) 我创建了一个新项目

ng new minimal-app
Run Code Online (Sandbox Code Playgroud)

它在本地和 Azure 上构建都很好。我编辑了 app.component.ts 以使用我的 UserModel,第 2、11 和 14 行

import {Component} from '@angular/core';
import {UserModel} from '../Models/User.model';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'minimal-app';
  user = new UserModel();

  constructor() {
    this.user.name = 'Jo';
  }

}
Run Code Online (Sandbox Code Playgroud)

User.model.ts 文件包含

export class UserModel {
  id: number;
  name: string;
}
Run Code Online (Sandbox Code Playgroud)

这也可以在本地和 Azure 上编译得很好。尝试添加嵌套模型时出现问题,请参阅 Action.model.ts

export class ActionModel { …
Run Code Online (Sandbox Code Playgroud)

azure-devops angular

4
推荐指数
1
解决办法
1235
查看次数

标签 统计

angular ×1

azure-devops ×1