Ember 3.0 withouth an optional client side template compiler?


#1

Hi,

I have to say that I am relatively new to ember. I like the tooling, speed and best practises it uses, and I understand that for normal approach you would not need a client side template compiler at all. (In fact I got around without it for quite a while now).

But there is one scenario where it is helpful to have the ability to have one (at the cost of size and speed - which is ok in this scenario):

=> When you want to plugin-enable your SPA for some reason without the need to set up the whole tooling to be able to precompile template at customers site.

Our use case is as follows:

  • have a SPA built and delivered with some sort of server software with an initial feature set (this can be done with the normal toolchain that ember has at development process)
  • allow for customer “extension points” where some additional routes/customization can be done that would also need new dialogs/pages to be added. for this I would like to use ember/glimmer templates.
  • For these small addons I wanted to provide an api that would use the es5 compatible globals mode to hook up new routes/controllers/templates for the to be added gui elements.

In Ember 2.18.2 this works perfectly. (because you still can bundle the ember-template-compiler with your app and use Ember.Htmlbars.precompile / Ember.Htmlbars.template to hook this up into the amd system.

Unfortunately these packages have been removed (or are not built and delivered) in Ember 3.0.

That is sad, because if that stays this way (or nobody can provide me with a better future proof way to implement such a scheme with ember) I will need to search for other frameworks that I can use to achieve this. (which is sad, because I got used to the “ember way” already).

In fact, this “backdoor” was one of the reasons, I choose Ember in the first place.

So Is there a way to bring the ember client side template-compiler back to Ember 3.0?

Regards, Jürgen.


#2

I’m curious what you mean here, the way we ship Ember (assuming you were using the ember-source npm package) has not changed (yet :wink: ). How were you doing this in 2.18, and how did it break when you upgraded to 3.0?


#3

Maybe I simply did something wrong - or I simply did not get what I needed to do/enable in ember to make it work.

But as far as I have seen, ember 3.0 has no @glimmer/compiler in the packaged result. However that (and its dependencies) is needed to use Htmlbars.precompile to generate the json wire format that you feed through Htmlbars.template during run time.

In 2.18.2 I simply added the https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.18.2/ember-template-compiler.js to my vendor tree, did an app.import in ember-cli-build.js and it was working.

What would be the correct approach with Ember 3.0?

Thanks for the quick response :slight_smile:


#4

Looks like I really missed something here:

  • what I was searching for is in the ember-source/dist directory …

so the template compiler package will be supported in the future. Thanks. that helps me :slightly_smiling_face: