Ember as an addon

I was just listening to Ember Weekend and they mention that Ember Data had been pulled out into an Ember addon https://github.com/emberjs/data/pull/3907

They also expressed excitement about Ember becoming an addon.

Can anyone explain why Ember Data as an addon is a cool thing, and what exactly is meant by “Ember as an addon”?

I’ll try to, but there are others who might be able to do a better job than me. And also, “a cool thing” is kind of subjective, so there might be some disagreement in this area.

I think first to understand why, you have to understand some of what an addon can do. The most primitive and obvious use case for an addon is just including ember-based runtime code, plugins for your app (eg ember-simple-auth, ember-truth-helpers). But the real brilliance of Ember CLI’s architecture (and Broccoli too) is that it’s completely pipeline driven and addons have the ability to modify that build pipeline! So think about an addon like ember-cli-sass, it doesn’t provide any ember-based runtime code, it’s all build tool and preprocessor related, but ember-cli doesn’t really distinguish between these addons.

So now imagine an addon that has both ember-based runtime code and build pipeline related code. Your addon can do things like including extra code for development, inject its own test helpers, provide better/smarter minification steps, allow for individual file importing, etc. In fact, the addon itself can be built as part of the application’s build step. Rather than what we have now in many cases where the addon is build into a single distributable JS file with other debug files (like source maps), then ember-cli tries to “unpack” that all again for debugging.

So that’s the power of the Ember CLI addon model. When it comes to Ember becoming an addon, I don’t know exactly what their plans are. I can imagine we’ll see more debugging tools and maybe even some preprocessing and minification improvements. But one other thing I can imagine that will nice is you could easily try out bug fixes in your app with a simple package.json modification. No manual js building required. You could also use your app to help debug and fix issues with ember.

1 Like

Thanks for the reply. I think this definitely helps. I’ll need to look at that PR more closely to understand what changed.

One thing that I’m now more confused about is the notion of an Ember Addon and Ember CLI Addon. Are those one in the same? Even though Ember CLI has become standard, I assumed they were different things.

One thing that I’m now more confused about is the notion of an Ember Addon and Ember CLI Addon. Are those one in the same? Even though Ember CLI has become standard, I assumed they were different things.

I think there might be a slight distinction in that the former, Ember Addon, could work without Ember CLI. Perhaps also possible using ember-giftwrap. But IMO Ember CLI addons are the only path forward and that as time goes on, that distinction will probably fade.

But again, someone else may be able to speak better than I to offical the terminology.

1 Like