首页 > 解决方案 > Angular Build 不工作 Base href 问题

问题描述

我正在 IIS 上部署角度构建,我认为我的主要问题是基础问题,这是我的

索引.html


<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>KEENU CFRS</title>
  <base href="/ClientApp">
  <!--// "build": "ng build --base-href=/CFRS.WebUI/",-->

  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
  <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500&display=swap" rel="stylesheet">
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body class="mat-typography">
  <app-root>
      <div class="main-spinner-wrapper">
        <div class="donut"></div>
      </div>
  </app-root>
</body>
</html>

这是我的 package.json

  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },

这是我的构建发布命令

ng build --prod --base-href /ClientApp/

这就是建造的地方

  "options": {
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.app.json",

我在 dist 建立我的

这是我构建的输出图片 在此处输入图像描述

这是我在 IIS 管理器中托管 Angular 构建的路径

E:\IIS Projects\ElasticCoreWebAPI_Public\feature\ClientApp\ClientApp

标签: angular

解决方案


推荐阅读