Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handlebars.runtime.amd.js doesn't seem to work #771

Closed
danwellman opened this issue Mar 23, 2014 · 3 comments
Closed

handlebars.runtime.amd.js doesn't seem to work #771

danwellman opened this issue Mar 23, 2014 · 3 comments

Comments

@danwellman
Copy link

I'm precompiling templates into a .js file and have set the amd: true option in the compiler so the generated file is wrapped in define(['handlebars'], function (Handlebars) {

However, having set a path in my require config like this:

'handlebars': '../bower_components/handlebars/handlebars.runtime.amd'

I'm seeing the message

Uncaught TypeError: Cannot call method 'template' of undefined

in the browser console. The error is thrown by the generated module. Why is handlebars undefined in my module?

@kpdecker
Copy link
Collaborator

I suspect that this is related to the default object that is exposed on the AMD modules but it's hard for me to say for certain without seeing the code that is failing. Can you create a jsfiddle or some other website that shows this error?

See #667

@danwellman
Copy link
Author

I'll see if I can put something together to illustrate the issue. Basically, after I posted this, I simply switched to the non-amd runtime and added a shim, and everything worked as expected without changing anything else at all. Until I get a repro together I'm happy to close the issue

@icoloma
Copy link

icoloma commented Apr 1, 2014

I arrived to this issue because I am experiencing the same problem with 2.0.0-alpha2. After fiddling a lot, I found that the first line in my precompiled templates is a = a["default"];. Since a is already the Handlebars instance (I modified handlebars.runtime to be an AMD module), this line sets it to undefined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants