问题
I'm an emberjs begginer and I have been searching how to add the "firebase" and "emberfire" dependencies to my ember application that I created using ember-cli. I used bower to install these 2 dependencies but I get this error:
Firebase is not defined
ReferenceError: Firebase is not defined
at eval (app/adapters/application.js:6:23)
at requireModule (loader.js:54:29)
at resolveOther (ember-resolver.js:158:20)
at superWrapper (ember.js:1267:16)
at Ember.DefaultResolver.extend.resolve (ember-resolver.js:205:17)
at superWrapper [as resolve] (ember.js:1267:16)
at Object.resolve [as resolver] (ember.js:41149:21)
at Object.Container.resolve (ember.js:10907:29)
at factoryFor (ember.js:11373:31)
at instantiate (ember.js:11434:21)
here's my adapter:
export default DS.FirebaseAdapter.extend({
firebase: new Firebase('https://(myfirebaseurl).firebaseio.com')
});
What should I do? I know I must have missed something, but I have already spent many hours and any answer given would be a great help ! Thanks in advance :)
回答1:
bower install firebase
- Add
emberfire/dist/emberfire.min.js
toBrocfile.js
inside thelegacyFilesToAppend
array. - Add a line in your bower.json file matching the version that you're using so that on a new checkout everything will continue to work.
People visiting this in the future: this applies to ember-cli 0.0.21 ONLY.
回答2:
Check out this example app by Stefan Penner https://github.com/stefanpenner/ember-cli-ember-fire/
回答3:
If anyone is still looking for this, I just created an ember-cli
addon that include both firebase and emberfire into the app.
All you need to do is run npm install --save-dev ember-cli-emberfire
from within your app and you should be good to go.
You can see the code here https://github.com/tikotzky/ember-cli-emberfire
回答4:
For those still looking for help with this, I was able to get my app working by starting from scratch in a new branch and following these instructions: https://github.com/stefanpenner/ember-cli/issues/185#issuecomment-39170635
来源:https://stackoverflow.com/questions/22874575/adding-firebase-emberfire-dependencies-to-an-ember-js-app-ember-cli