-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
includeRoutesInApplication option does not initialize the lazy engine routes #738
Comments
I created a reproduction (https://github.com/gtb104/lazy-engine). In it I've defined: lazyLoading: Object.freeze({
enabled: true,
includeRoutesInApplication: false
}) When the app loads in the browser, I get the following error: What I expect to happen is the link to create successfully, and to properly route to the "foo" route when clicked. |
Clone the repo, start the server, then open a browser and go to localhost:4200. In the console you’ll see errors about it not being able to build the link to the `lazy-engine.foo` route.
Kindest regards,
Geoff
… On Dec 5, 2020, at 10:46 AM, Michael Villander ***@***.***> wrote:
@gtb104 which are the steps to test it? should I access the route? http://localhost:4200/foo ?
Please give us more details and then I'll try to debug it
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
@gtb104 @AbhinavVishak I'm not sure if this behavior is unexpected, given we don't any documentation clear about this attribute I can see in the codebase that we have a JS doc saying that when this attribute is What the behavior expected here? Is there another version of ember-engines where it worked as you expected? ember-engines/packages/ember-engines/lib/engine-addon.js Lines 589 to 595 in 92b84b3
|
Perhaps I don’t understand the intent of PR425 (#425). It states:
Introduces a new lazyLoading.includeRoutesInApplicationoption which enables lazy engines to output their routes.js file to a stand-alone file rather than bundling it into the hosts vendor.js file.
This will enable engines to be discovered dynamically at runtime rather than requiring engines to be declared statically at build time.
To me, that implies it doesn’t promote and bundle the lazily loaded engine’s routes at build time, deferring discovery until run time.
We have an app with a frozen code base. One of the engines it uses is still under active development. What I envision setting includeRoutesInApplication to false would allow is for new routes to be added to the actively developed lazy engine, and the frozen parent app would be able to discover them dynamically at runtime.
Kindest regards,
Geoff
… On Dec 5, 2020, at 11:05 AM, Michael Villander ***@***.***> wrote:
@gtb104 @AbhinavVishak I'm not sure if this behavior is unexpected, given we don't any documentation clear about this attribute I can see in the codebase that we have a JS doc saying that when this attribute is false we don't want to promote the routes into the host.
What the behavior expected here? Is there another version of ember-engines where it worked as you expected?
https://github.com/ember-engines/ember-engines/blob/92b84b33e4eb0bb5be64fb77578133986aa28d0c/packages/ember-engines/lib/engine-addon.js#L589-L595
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
For sure this behavior isn't supported to ember-engines, all things on manifest.json to load engines are created on build time. could you please clarify the expected behavior of includeRoutesInApplication @rwjblue @dgeb? I never used it. |
@dgeb @bertdeblock any thoughts here? |
I've moved on to another project, and it looks like this is dead, so it can be closed. |
I'm also curious about the intended behavior of |
@daniellubovich It's been a long time since I used This main motivator for this being to enable engines to be built in isolation, and also allow them to be side-loaded into an Ember.js application, without the engine itself needing to be present at build time of the parent application. This effectively meant that you could use engines to dynamically extend an Ember.js application at runtime. Hope that makes sense 🙂 |
@mike183 Ah, okay that totally makes sense. I had assumed there was something in Either way, this clears things up. Thanks for the reply! |
Change the lazyLoading option to
{ enabled: true, includeRoutesInApplication: false }
inlib/lazy-engine/index.js
Add a simple
console.log('foobar')
inside the buildRoutes function inlib/lazy-engine/addon/routes.js
ember s
go to
localhost:4200/lazy-engine
The console log never shows up. Adding a breakpoint/logpoint on the define("lazy-engine/routes") triggers the define statement however.
The text was updated successfully, but these errors were encountered: