Error when trying to use Ember with Handlebars (runtime-only) #1303

Closed
ermakovich opened this Issue Aug 21, 2012 · 8 comments

Projects

None yet

5 participants

@ermakovich

Ember: 1.0.pre
Handlebars: runtime-1.0.0.beta.6

An exception is thrown when Ember tries to access Handlebars.Compiler.prototype property:

TypeError: Cannot read property 'prototype' of undefined.

Is it possible to make Ember to work with Handlebars (runtime-only)? Is it a supported scenario?

Member

There is one issue preventing Ember from working with runtime-only Handlebars at the moment. Ember.Select has a defaultTemplate that is inline handlebars. If you comment out that line, you can use Handlebars (runtime-only).

Thanks a lot!
Any ideas how to make known Ember's helpers work? When I use action helper for example, I get the following error:

Error: Could not find property 'action'

Member

@ermakovich that's unrelated to this ticket and probably a good question to ask on stack overflow with a code example / jsfiddle.

@ermakovich ermakovich closed this Aug 21, 2012
NkS90 commented Jan 2, 2013

Does ember.js support handlebars runtime now?

Member

The Ember.Select issue still prevents runtime-only Handlebars from working with Ember out of the box.

We are currently precompiling our templates and using the following hack (loaded before Ember):

// Ember currently tries to compile a Handlebars template for Ember.Select,
// which is the last remaining blocker to just using the Handlebars runtime
// in production. To avoid that blowing up, we are stubbing out the required
// compilation-related functions so that Ember can load without error.

Handlebars.Compiler = function(){};
Handlebars.Compiler.prototype.compile = function () {
};
Handlebars.JavaScriptCompiler = function(){};
Handlebars.JavaScriptCompiler.prototype.compile = function () {
};
Handlebars.parse = function(){};
Handlebars.compile = function(){};
@lukemelia lukemelia reopened this Jan 2, 2013
Owner
trek commented Jan 2, 2013

We really should have a precompile phase of the dist task. There's no reason to ship built-in templates as a string.

Owner
trek commented Jan 2, 2013

I moved precompilation earlier in #1660

Owner
wagenet commented Jan 14, 2013

Closing in favor of discussion on #1660.

@wagenet wagenet closed this Jan 14, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment