【问题标题】:Lazy Load Non-Routable Modules in Angular with angular-meteor使用 angular-meteor 在 Angular 中延迟加载不可路由的模块
【发布时间】:2019-07-28 05:44:18
【问题描述】:

我按照本教程https://netbasal.com/the-need-for-speed-lazy-load-non-routable-modules-in-angular-30c8f1c33093 加载了一个不可路由的模块。

但是指示 Angular 要求 Webpack 为我们的模块创建一个单独的块以便我们稍后可以在 angular.json 中延迟加载它的步骤无法实现它,因为我正在使用 MeteorCLI,如下面的 Urigo / angular 示例-流星https://github.com/Urigo/angular-meteor/tree/master/examples/MeteorCLI/all-in-one

尝试通过 load-module.directive.ts 加载模块时遇到的错误是:

ERROR ReferenceError: System is not defined

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 中实现延迟加载不可路由的模块

【问题讨论】:

    标签: angular meteor lazy-loading angular-meteor


    【解决方案1】:

    看看https://github.com/wishtack/wishtack-steroids/tree/master/packages/reactive-component-loader

    这允许您在不需要路由的情况下加载角度模块。它并不完美或简单,但它可以帮助您入门。

    在我的构建中尝试使用 aot 进行编译时存在一些问题,我不得不稍微编辑它以使其工作,但这可能只是我做错了。

    【讨论】:

    • 嗨,谢谢你回答我,但是当我加载应用程序时 Meteor 构建它时,我得到编译错误: Uncaught SyntaxError: Unexpected token export Uncaught TypeError: Cannot read property 'meteorInstall' of undefined at babel ?-runtime.js哈希= 134c95e906ec8740d8437618b59f7dfc1170c9ac:17巴贝尔-runtime.js哈希= 134c95e906ec8740d8437618b59f7dfc1170c9ac:155遗漏的类型错误:无法读取属性 'meteorInstall' 在promise.js哈希= c4530b4991a1ee60c1ba4dca3fd9d4e8acfff78d未定义:??17在promise.js哈希= c4530b4991a1ee60c1ba4dca3fd9d4e8acfff78d:164 ....
    • 我发现 Meteor 构建的问题是由于 ES 版本。我的 tsconfig 的配置是“lib”:[“es2018”,“dom”],并且使用“es2015”构建工作。
    猜你喜欢
    • 2018-05-22
    • 2023-01-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-30
    相关资源
    最近更新 更多