indexiatech / ember-forms

Smart, Intuitive forms for Ember.js styled with Bootstrap, Multi layouts and Validation support.
http://indexiatech.github.io/ember-forms
Apache License 2.0
218 stars 45 forks source link

"undefined is not a function error" in ember-cli Production environment #44

Closed camdub closed 9 years ago

camdub commented 10 years ago

Ember-forms is working great, but when I run the ember-cli server in production mode I get an Uncaught TypeError: undefined is not a function error. Since this only happens in production, I'm not even sure how to start trying to find the source of this. If I remove ember-forms from my app, it works as normal (except the pages using the forms of course).

I suppose I could turn off minification in the production script to try and find the issue.

I am simply including the globals version in my Brocfile: app.import('vendor/ember-forms/dist/globals/main.js');

Here is a screenshot of the error message which might help: http://inft.ly/fvPryUr

asaf commented 9 years ago

@camdub If it works in dev mode, my guess is that there is some precompiled template, try to add full handlebars (as default is only the runtime) and see if it works.

samselikoff commented 9 years ago

I ran into this exact problem tonight. Unfortunately it took me quite a while to figure out it was ember-forms. I'd like to help out so it doesn't happen to the next person.

I disabled minification and tracked down the error:

image

@asaf as you suspected, Ember.Handlebars.compile is not defined. Could you elaborate on your comment? We shouldn't need to add the Handlebars compiler just to use ember-forms, should we?

asaf commented 9 years ago

@samselikoff I guess we can get ride of compile in runtime requirements, but it will take some time..... If someone has the time to clean these up it'll be great.

CharlieWhite commented 9 years ago

For anyone else coming across this issue, here's a less than ideal fix:

Ember CLI doesn't provide the full Handlebars compiler in production, but you can easily include it, see:

http://www.ember-cli.com/#customizing-a-built-in-asset

Longer term, Ember Forms would ideally pre-compile their templates.

sharpner commented 9 years ago

+1

Emerson commented 9 years ago

Running into this as well

asaf commented 9 years ago

grep -r Handlebars * result nothing, can someone point out where are the non pre compiled templates?

Thanks

pedrokiefer commented 9 years ago

@asaf I think this was before the migration to es6 style and ember-cli. Just tested using last release and I don't have this issue anymore. I'll close #62 as ember-cli handles template compilation.

yangbai1991 commented 7 years ago

Running into this as well

asaf commented 7 years ago

@yangbai1991 Sorry I have no time to maintain this project any longer, seeking for maintainers though