angular - 使用 angular-meteor 在 Angular 中延迟加载不可路由的模块
问题描述
我按照本教程https://netbasal.com/the-need-for-speed-lazy-load-non-routeable-modules-in-angular-30c8f1c33093加载了一个不可路由的模块。
但是指示 Angular 要求 Webpack 为我们的模块创建一个单独的块以便我们稍后可以在 angular.json 中延迟加载它的步骤无法实现它,因为我正在使用 MeteorCLI,如下面的 Urigo / angular-meteor https示例://github.com/Urigo/angular-meteor/tree/master/examples/MeteorCLI/all-in-one
尝试通过 load-module.directive.ts 加载模块时出现的错误是:
错误参考错误:系统未定义
at SystemJsNgModuleLoader.loadAndCompile (modules.js?hash=9d3d781b9164d8358322d2f1c42fce556c401bbc:42359) at SystemJsNgModuleLoader.load (modules.js?hash=9d3d781b9164d8358322d2f1c42fce556c401bbc:42351) at LoadModuleDirective.ngOnInit (load-module.directive.ts:48) at checkAndUpdateDirectiveInline (modules.js?hash=9d3d781b9164d8358322d2f1c42fce556c401bbc:46075) at checkAndUpdateNodeInline (modules.js?hash=9d3d781b9164d8358322d2f1c42fce556c401bbc:47339) at checkAndUpdateNode (modules.js?hash=9d3d781b9164d8358322d2f1c42fce556c401bbc:47301) at debugCheckAndUpdateNode (modules.js?hash=9d3d781b9164d8358322d2f1c42fce556c401bbc:47935) at debugCheckDirectivesFn (modules.js?hash=9d3d781b9164d8358322d2f1c42fce556c401bbc:47895) at Object.eval [as updateDirectives] (provider-details.component.html:296) at Object.debugUpdateDirectives [as updateDirectives] (modules.js?hash=9d3d781b9164d8358322d2f1c42fce556c401bbc:47887)
技术规格:
- 角 7
- 流星1.8
有人可以告诉我如何在 angular-meteor 中实现延迟加载不可路由的模块
解决方案
看看https://github.com/wishtack/wishtack-steroids/tree/master/packages/reactive-component-loader
这允许您在不需要路线的情况下加载角度模块。它并不完美或简单,但它可以帮助您入门。
尝试在我的构建中使用 aot 进行编译存在一些问题,我不得不稍微编辑它以使其工作,但这可能只是我做错了。
推荐阅读
- javascript - 如何使用 javascript 将文件上传到 FTP 服务器?
- python - 根据 pandas 中的字典对数据帧的行进行分组并对相应的分子求和
- python-3.x - 导入无法解决 Pylance
- c++ - 销毁 std::vector 中的对象
- c# - 如何使用流利的断言断言集合中的所有项目都不同?
- pandas - 如何获得两只熊猫df的比例
- flutter - 是否可以在颤振(飞镖)列表中存储变量或函数值?
- azure-sql-database - 如何编辑 365 群组用户的 SQL 权限
- c# - 无法确定关系 - 实体框架核心
- git - 用于在 2 个站点上开发的 Git