在Angular 15和msal-angular v3中解决"模块解析失败:未启用顶级等待实验"错误可以通过以下步骤进行:
首先,确保你的Angular版本为15或更高版本,并且你已经正确安装了msal-angular v3。
在你的Angular项目的根目录下,打开 tsconfig.json
文件。
在 compilerOptions
部分中添加以下配置:
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"topLevelAwait": true
这些配置将启用实验性的顶级等待功能,以解决该错误。
tsconfig.json
文件,并重新编译你的Angular应用程序。这样,你就解决了"模块解析失败:未启用顶级等待实验"错误。
以下是一个示例的 tsconfig.json
文件:
{
"compilerOptions": {
// 其他配置...
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"topLevelAwait": true
},
// 其他配置...
}
确保你的配置与上述示例相似,并且没有其他冲突的配置。然后重新编译你的应用程序,该错误应该就会解决了。