question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lazy Loading Route-less Engines

See original GitHub issue

I don’t think this feature has been implemented / tested but I’ll go ahead and log an issue for tracking. Lazy-loading non-routeable engines is not working. The assets are never loaded and as such are not registered…

I end up with this error “Assertion Failed: You used {{mount 'nonrouteable'}}, but the engine ‘nonrouteable’ can not be found.”"

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:3
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

11reactions
aalasolutions-zzcommented, Feb 7, 2017

Any updates on this? Our app is route-less and need to use lazy loading for the engine. Main JS file is like 3MB and some users are not having access to all the areas.

8reactions
villandercommented, Feb 3, 2018

Route-less Engines, on the other hand, are Engines which are not able to be routed to. This means that they don’t live at a specific route, but are instead mounted within a template or your application. Examples of good candidates for route-less Engines are chat boxes or complex forms.

Following the concept of route-less, I think we should start the request to load the Engine assets, when the template of that route / component is called. We can do something like what React does:

import React from 'react';
import { render } from 'react-dom';
import { BrowserRouter as Router, Route } from "react-router-dom";

import AppTemplate from './commons/ui/components/AppTemplate';
import AsyncComponent from './AsyncComponent';
import basePath from './commons/utils/basePath';

import "./style/app.scss";

const home = () => import(/* webpackChunkName: "home" */ './modules/home/index');
const projects = () => import(/* webpackChunkName: "projects" */ './modules/projects/index');
const contact = () => import(/* webpackChunkName: "contact" */ './modules/contact/index');

render(
  <Router>
    <AppTemplate>
      <Route path={basePath``} exact={true} component={() => <AsyncComponent moduleProvider={home} />} />
      <Route path={basePath`projects`} exact={true} component={() => <AsyncComponent moduleProvider={projects} />} />
      <Route path={basePath`contact`} exact={true} component={() => <AsyncComponent moduleProvider={contact} />} />
    </AppTemplate>
   </Router>,
  document.getElementById("app")

Yeah, this hasn’t really been considered yet. I think the primary question was how to handle the fact that the mount point will render asynchronously. Once that is determined, we just need to identify where we in that lifecycle we initiate the request to load the Engine assets.

I would love to work on this and various features of ember-engines, but I need someone to introduce me to the gears of this addon

Read more comments on GitHub >

github_iconTop Results From Across the Web

ember-lazy-mount
As soon as the helper is rendered, it will begin loading the specified engine. If the engine is already loaded, it will be...
Read more >
Dynamically loading an Ember component
I investigated Ember Engines, but it doesn't seem suitable, as lazy-loading does not work with route-less engines. As I understand it, ...
Read more >
@buschtoens/ember-engines NPM | npm.io
Route-less engines, which can be rendered in a template using the {{mount}} keyword. ... Until lazy loading is supported, this should be set...
Read more >
Benefits of Lazy Load for WordPress - WP Engine
Lazy loading elements of your WordPress site can be a great way to speed up your page! Check out the comprehensive WP Engine...
Read more >
Popular "keywords:"engines"" JavaScript packages | Skypack
Check engines you have defined in a file or `package.json` section that satisfies your global or locally ... {{mount}} lazy loading route-less engines....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found