首页 > 解决方案 > msal 问题:意外的令牌 < 在 Angular 5 应用程序中

问题描述

几天以来,我一直在尝试解决此问题,我们将不胜感激。我正在尝试在 Angular 5 应用程序中导入 msal(v0.2.0)。我正在做的事情是:

import '../../../../../node_modules/msal/dist/msal'
/// <reference path="../../../../../node_modules/msal/dist/msal"/>
import * as Msal from 'msal'

因此,每当我运行我的应用程序并尝试浏览它时,我都会得到:

localhost/:64 SyntaxError: Unexpected token < at evaluate ( http://localhost:5555/node_modules/systemjs/dist/system.src.js?1533829762220:2802:16 ) 在http://localhost:5555/node_modules/systemjs /dist/system.src.js?1533829762220:3607:23 在 doEvaluate ( http://localhost:5555/node_modules/systemjs/dist/system.src.js?1533829762220:1138:28 ) 在 doEvaluate ( http:// localhost:5555/node_modules/systemjs/dist/system.src.js?1533829762220:1085:15 ) 在 ensureEvaluate ( http://localhost:5555/node_modules/systemjs/dist/system.src.js?1533829762220:993:15 ) 在http://localhost:5555/node_modules/systemjs/dist/system.src.js?1533829762220:1011:22 在 Object.eval (http://localhost:5555/app/shared/auth/auth.service.js:54:1)在评估(http://localhost:5555/app/shared/auth/auth.service.js:337:4 ) 在 eval ( http://localhost:5555/app/shared/auth/auth.service.js:338:3 )

有没有办法解决 ?这是在 Angular 5 应用程序中导入 msal 的正确方法吗?

任何帮助将不胜感激。

标签: msalmsal.js

解决方案


通过将 msal 添加到 project.config.ts 文件来解决此问题。

{ 名称:'msal',路径:'node_modules/msal/dist/msal.js' }


推荐阅读