SystemJS 6.x设置register模块或在动态加载模块时提供映射。

问题描述 投票:0回答:1

我正试图在我的Angular 8应用程序中使用systemjs 6.x版本动态加载模块。

鉴于目前的文档,我可以使用systemjs API来注册或以编程方式设置模块。

https:/github.comsystemjssystemjsblobmasterdocsapi.md#systemetid-module--module

试着这样做,但是看起来systemjs并没有发现@angularcore的踪迹

import * as angularCore from '@angular/core';
System.set('@angular/core', angularCore);

我是应该用集? 还是注册这个?https:/github.comsystemjssystemjsblobmasterdocsapi.md#systemregisterdeps-declare。

看来我也可以提供一个导入地图。

https:/github.comsystemjssystemjsblobmasterdocsimport-maps.md。

我试着在index.html中添加该映射,但没有任何收获。

<script type="systemjs-importmap">
{
  "imports": {
    "@angular/core": "node_modules/@angular/core/bundles/core.umd.js"
  }
}
</script>

当使用Angular CLI时,systemjs是否已经包含在我的Angular构建中,这样我就可以直接注入我的Angular应用程序已经使用的SystemJS,希望所有的映射都已经为我的所有依赖定义了?

angular angular-cli angular8 systemjs
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.