Adding firebase & emberfire dependencies to an ember.js app (ember-cli)

江枫思渺然 提交于 2019-12-10 18:11:30

问题


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:


  1. bower install firebase
  2. Add emberfire/dist/emberfire.min.js to Brocfile.js inside the legacyFilesToAppend array.
  3. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!