angular6 - 修复 Internet Explorer 11 + Angular 6+ 项目中的语法错误

标签 angular6 azure-ad-msal angular7 msal.js

我在 Angular 6Angular 7 中使用 msal.js "@azure/msal-angular": "^0.1.2" 项目,我收到以下错误:

SCRIPT1002: Syntax error
vendor.js (64379,1)

第 64379 行的 .js 代码

class AuthenticationResult {
constructor(token, tokenType) {
    this._token = "";
    this._tokenType = "";
    this._token = token;
    if (tokenType) {
        this._tokenType = tokenType;
    }
}
get token() {
    return this._token;
}
set token(value) {
    this._token = value;
}
get tokenType() {
    return this._tokenType;
}
set tokenType(value) {
    this._tokenType = value;
}}

我添加了 rxjs-compat npm 模块来支持 Angular 6+。

尝试对 IE 11 进行以下修复:

未注释的polyfills.ts

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/Using-msal.js-with-Internet-Explorer

最佳答案

此修复目前对我有效。

问题: NPM 包 @azure/msal-angular 中的 dist 文件夹 (@azure\msal-angular\dist) 对于 IE11 编译不正确。

修复: 重新编译 ts 文件 (https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular) 并添加到您的项目 node_modules\@azure\msal-Angular\dist

步骤

  1. 克隆并 npm install https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular
  2. npm run build:modules
  3. lib-es6复制新创建的文件
  4. lib-es6 文件粘贴到您的 Angular 项目 node_modules\@azure\msal-angular\dist

npm start 你的 Angular 项目。

关于angular6 - 修复 Internet Explorer 11 + Angular 6+ 项目中的语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53196989/

相关文章:

angular - 在 Angular 6 中从控制台隐藏 IE 警告

Angular 6 DataTables - 如何获取当前页面

azure - 如何使用 azure msal 库访问 azure 服务管理 api?

azure - 如何调试承载错误="invalid_token"

angular - 在 angular 7 中获取路由参数为空

javascript - 为什么我在输入中看到 [object Object]?

html - Angular 6 - 移动设备上的按键空间

angular - 如何在子组件中使用 formGroupName

azure - 在 .NET Core 控制台应用程序中以编程方式创建 New-AzureRmRoleAssignment

node.js - 运行 Angular 项目会出现 Node-sass 错误