Amazon cognito Angular 8获取AWS Cognito用户会话

Amazon cognito Angular 8获取AWS Cognito用户会话,amazon-cognito,angular8,Amazon Cognito,Angular8,我试图阅读Angular 8项目中的AWS Cognito用户会话 步骤1:在my package.json中添加“amazon cognito identity js”:“3.2.1” 步骤2:在我的组件文件中,将包作为 import { CognitoUser, CognitoUserSession } from 'amazon-cognito-identity-js'; 步骤3:作为 constructor(private hc: HttpClient, private cu: Cogn

我试图阅读Angular 8项目中的AWS Cognito用户会话

步骤1:在my package.json中添加“amazon cognito identity js”:“3.2.1”

步骤2:在我的组件文件中,将包作为

import { CognitoUser, CognitoUserSession } from 'amazon-cognito-identity-js';
步骤3:作为

constructor(private hc: HttpClient, private cu: CognitoUser, private cus: CognitoUserSession) { }
步骤4:将函数中的用户会话读取为

this.cus = this.cu.getSignInUserSession();
步骤5:在命令提示符下,执行“ng build--prod”,我得到以下错误

-------------------错误------------------

./src/app/features/MYcomponent.ngfactory.js中出错 未找到模块:错误:无法解析“C:…”中的“amazon cognito identity js/index” 解析“C:…”中的“amazon cognito identity js/index” 已解析的请求是一个模块 使用描述文件:C:…\package.json(相对路径:./src/app/features/…) 字段“browser”不包含有效的别名配置 解析为模块 正在查找C:/…中的模块/ 使用描述文件:C:…\package.json(相对路径:) 字段“browser”不包含有效的别名配置 使用描述文件:C:…\package.json(相对路径:./amazoncognito-identity-js/index) 没有分机 字段“browser”不包含有效的别名配置 C:…\amazon cognito identity js\index不存在。ts 字段“browser”不包含有效的别名配置