angular / angular/angular-cli

Fonts are not resolved when using base href

未关闭
#30,332 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
angular/build:application area: @angular/build area: docs
主要语言
TypeScript
星标
27k
派生
11.8k
平均合并
14 小时 23 分钟
30 天内合并 PR
162

描述

### Command

build

### Is this a regression?

- [ ] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

_No response_

### Description

I'm trying to deploy an Angular application to GitHub Pages using GitHub Actions. I've set the base href correctly, but the sources aren't showing up. The routes to get the sources ignore the base href. I've also tried specifying the deploy-url, but I get the same result.

### Minimal Reproduction

1. Create a project.
2. Add a custom font that's in the public folder.

![Image](https://github.com/user-attachments/assets/3c1d5e3d-e896-4fd6-830c-e5db839c1ab3)

3. Build the project with a base href and deploy it.
4. Note that the font URL ignores the base href.

### Exception or Error

```text

```

### Your Environment

```text
Angular CLI: 19.1.7
Node: 22.14.0
Package Manager: npm 10.9.2
OS: win32 x64

Angular:
...

Package Version
------------------------------------------------------
@angular-devkit/architect 0.1901.7 (cli-only)
@angular-devkit/core 19.1.7 (cli-only)
@angular-devkit/schematics 19.1.7 (cli-only)
@schematics/angular 19.1.7 (cli-only)
```

### Anything else relevant?

_No response_

贡献指南

打开贡献指南

调研方向

首先,使用 `public` 文件夹中的自定义字体和已配置的 base href 重现 `build` 命令。跟踪 Angular CLI 构建如何生成字体 URL,然后验证构建输出会在基路径下解析该 URL,而不是在站点根目录下解析。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
build-system
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。