在 salesforce lightning 中加载库 mapjs-core 和 mapjs-service 时出错

Error while loading library mapsjs-core and mapsjs-service in salesforce lightning

我正在尝试在 Lightning 组件中加载 Here 地图库,但在加载页面上出现以下错误。

[无法读取未定义的 属性 'Object'] 评估()@https://wellmanage--onbdev.lightning.force.com/resource/GRG_Leaflet/GRG_Leaflet/Here-mapsjs-core.js:6:1666 Proxy.eval()@https://wellmanage--onbdev.lightning.force.com/resource/GRG_Leaflet/GRG_Leaflet/Here-mapsjs-core.js:320:26

根据堆栈跟踪和错误,HERE 脚本似乎是在无法访问 JavaScript window 对象的环境中加载的,因此无法正确评估.

我不熟悉 Salesforce Lightning,但应该可以执行 JavaScript 代码,因为它们的 documentation 状态:

A component bundle can contain JavaScript code in a client-side controller, helper, or renderer. Client-side controllers are the most commonly used of these JavaScript resources.

但是,似乎有一种特殊的方式来加载外部脚本,this page 中对此进行了描述。特别是:

The framework’s content security policy mandates that external JavaScript libraries must be uploaded to Salesforce static resources. For more information on static resources, see “Static Resources” in the Salesforce online help.