ember-auto-import icon indicating copy to clipboard operation
ember-auto-import copied to clipboard

Support for lazy engines

Open Turbo87 opened this issue 7 years ago • 3 comments

It seems that ember-engines is currently not supported by this project, but it would be great if lazy engines could also take advantage of the automatic bundling.

Turbo87 avatar Jun 25 '18 13:06 Turbo87

Yes. I'm pretty sure non-lazy engines are already supported.

For lazy-engines, I think they technically already work (meaning nothing actually breaks), but everything imported from the lazy engine would end up in vendor.js, so would not be lazy.

Fixing this is probably not very hard. Right now, we pick one package (meaning an app or addon) that is using ember-auto-import to be the primary and actually do the bundling. All the others that are using ember-auto-import just hook their source trees into the primary's import analyzer.

Instead of picking a single global primary, each package should look upward through its ancestor packages and stop when it finds a lazy engine, and only share the bundler within the engine.

ef4 avatar Jun 25 '18 14:06 ef4

While I would still like to fix this issue directly, a workaround is now available. Lazy engines can use dynamic import() to lazily load their own dependencies.

ef4 avatar Jul 12 '18 19:07 ef4

Hello! we're doing some issue triage and wanted to provide resolution to various issues, and provide closure for some issue, or confirm that they are still a problem, and that we haven't forgotten.

For lazy engines, they are supported under embroider, here is an example test, using a lazy engine

In ember-auto-import, the issue could still be present (as it is now 5 years later), and it would be fantastic to have a PR for a failing test scenario (maybe even copying from the embroider test!).

Thank you!!

NullVoxPopuli avatar Jul 05 '23 14:07 NullVoxPopuli