#Ember.js and Embroiders

1 messages · Page 1 of 1 (latest)

forest ginkgo
#

Hello, I have just started working on an Ember.js legacy application, and we are looking to improve the build and load time of the app. The environment that we are working on is:
ember-cli : v2.16.2
ember-source: v3.4.8
We use pods structure and Ember.js classic components

I just came across Embroider and the readme mentions that it is compatible with Ember.js v3.28 and higher. It looks like, if we upgrade our app to v3.28 it will help us use Embroider to reduce our load time (particularly the splitAtRoutes mode).

My transition plan is as follows:

  1. Upgrade to Ember3.28
  2. Start using Embroider
  3. Refactor few components to Angle bracket syntax - (All components cannot be refactored to use the Angle bracket syntax)
  4. Convert few classic components to glimmer components - (All components cannot be refactored as Glimmer components)

I currently have two queries:

  1. We are planning to start step3 at a later point in time and there will be a significant gap of time between step 2 and 3, so can we upgrade to Ember.js 3.28 and leverage Embroider's capabilities, but still use Ember.js classic components and the pods structure, and then later continue from step3 in the plan?

  2. Our app uses components helper to render dynamic components for a wide range of usecases, how does Embroider handle dynamic-components? I did see an option to use the ensure-safe-component helper, but I am still not sure what exactly it does. Does it exclude components that use the components helper from code-splitting, or is there some other way that it handles this case?

Apologies, if this is not the right place to post this, or if these doubts are extremely trivial, but I have just started working on ember.js and these queries are based on my current understanding of it. TIA!

rare ginkgo
#

I'm not on the Embroider team so take all of this with a grain of salt:

  1. Embroider specifies ember-source of 3.28.11 or greater, so at least that version of Ember should work. Note that some things may not work once you hit ~3.27 or so, that's one of the hurdles we have with a lot of our apps. Also - I don't know how far the pod structure is supported for, and it may not work with Embroider. My company has a basic tool to "unpodify" applications. Note that it only moves files around to their proper location, it will likely result in broken code as it doesn't update imports.
  2. The component helper is still allowed, it really depends on how "dynamic" your "dynamic components" are. If the component you're using can be narrowed to essentially an if/else chain or a switch block (a static component is used under a given condition), then I think Embroider should be fine. It's when you base which component to use on a value known only at runtime will Embroider have issues (I believe).
forest ginkgo
rare ginkgo
#

In that case, I don’t know enough about the component helper with Embroider. Best of luck!