Binary compatibility of precompiled HTMLBars


#1

Seem Ember 1.11 have a breaking change that is not compatible with template compiled by ember-template-compiler v.1.10 by adding a new revision field in the compiled template. Should I assume there will be no binary compatiblity for precompiled HTMLBars template for every new release?


#2

“binary” compatibility isn’t really a thing, but I know what you mean.

A template compiled with one version of Ember will not be compatible with a different runtime version of Ember. You should always use the same ember-template-compiler version as your runtime.


#3

This was true as of Ember 1.10 also, though we did not have a field to confirm/check so many folks had issues with templates compiled with different versions. That is why we added the check and a helpful error message.

This blog post explains the rationale and a few examples of how to do the template compilation if you are not using Ember CLI: http://emberjs.com/blog/2015/02/05/compiling-templates-in-1-10-0.html


#4

Thanks for clarification. However, that will mean ember.js based library that is distribute as Globals based distribution instead of ember-cli addons will need to have different versions for each version of ember.js unless the templates is split out into separate file. Is that correct?


#5

I’m curious about this as well. Our component lib precompiles templates so the client app just has to source the lib.js, no additional compile step. Now this warning has come up.

What are the options besides conversion to Ember CLI?

One way I see, is to stop precompiling the templates in the lib, distribute the template sources, and force the client app to Compile It Yourself. That would work for whatever Ember version the client has. But at runtime, how can lib.js resolve the templates the client compiled?