Angular Preview angular 的 MSAL webpack AOT 编译不包括 resourceMap

MSAL for Angular Preview angular webpack AOT compilation not including resourceMap

我正在创建我的 protectedResourceMap 并将常量传递给@NgModule,如文档中所述。

export const  protectedResourceMap: Map<string, Array<string>> = new Map<string, Array<string>>();

protectedResourceMap.set("https://graph.microsoft.com/v1.0/me", ["user.read"]);
protectedResourceMap.set("https://buildtodoservice.azurewebsites.net/api/todolist", ["api://a88bb933-319c-41b5-9f04-eff36d985612/access_as_user"]);

@NgModule({
  imports: [ MsalModule.forRoot({
                  clientID: Your client ID,
                  protectedResourceMap : protectedResourceMap
                })]
           })

https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-angular/README.md

但是当我 运行 ng 使用 --prod 构建时(默认情况下启用 AOT),然后 AOT 编译器尝试优化代码,它添加MSalConfig 的所有其他参数,但它不添加我的 resourceMAP(如下图所示)。

如果我在 Angular.Json 文件中关闭 buildOptimizer 和 AOT,它工作正常。

这是一个错误吗?关于如何解决这个问题的任何想法?

我在 MSAL github 项目中发布了一个问题,他们回答了一个修复,将在新版本中发布。 顺便说一句,这个问题与 Angular.

的 MSAL 包装器版本 0.2.2 有关

您可以在此处查看更多相关信息: https://github.com/AzureAD/microsoft-authentication-library-for-js/issues/407