我在 Angular 6
和 Angular 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" />
最佳答案
此修复目前对我有效。
问题:
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
步骤
- 克隆并 npm install https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular
- npm run
build:modules
- 从
lib-es6
复制新创建的文件 - 将
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/