如何设置 Angular“Native Federation”以在开发模式下通过 https 提供服务

问题描述 投票:0回答:1

我对 angular.json 中“serve”部分的常规 Angular 设置如下所示:

"serve": {
  "builder": "@angular-devkit/build-angular:dev-server",
    "options": {
      "sslKey": "./dev-server-certs/localhost.key",
      "sslCert": "./dev-server-certs/localhost.crt",
      "ssl": true
    }
},

这个效果很好。现在我已经创建了一个 shell 应用程序,它应该加载其他微前端。自动生成的“服务”部分(由 Native Federation 创建)如下所示:

"serve": {
  "builder": "@angular-architects/native-federation:build",                  
    "options": {
      "target": "shell:serve-original:development",
      "rebuildDelay": 0,
      "dev": true,
      "port": 0
    }
}

我也尝试添加 ssl... 键,但是当运行 ngserve 时,我仍然得到 http://localhost:4xxx 作为要使用的链接。我无法找到如何通过 https 服务新的 shell 应用程序(和遥控器)的方法。

angular https native foundation micro-frontend
1个回答
0
投票

它应该有效:

"serve-original": {
  "builder": "@angular-devkit/build-angular:dev-server",
  "configurations": {
    "production": {
      "buildTarget": "shell:esbuild:production"
    },
    "development": {
      "buildTarget": "shell:esbuild:development"
    }
  },
  "defaultConfiguration": "development",
  "options": {
    "port": 4200,
    "sslKey": "./dev-server-certs/localhost.key",
    "sslCert": "./dev-server-certs/localhost.crt",
    "ssl": true
}
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.