Combining Component Logic and Template together in single file?

I have been doing some thinking in this area of distributed components for a system that would actually load components dynamically on the fly. I believe that an approach could be to have one file contain the requirejs define for both the javascript and the template. that would actually mean that a component would be self-registering.

You can then filter and find all registered components through requirejs (this could be done within Ember but I don’t know how).

Since they now are registered you can instantiate them. One way would be to get the class using requirejs directly (this is the only way I know how to do) the other would be to get it through something that Ember exposes (but I dont know what that is).

Obviously there are challenges with this approach but I will do some experiments with this.