mikkopaderes / ember-firebase-service

Exposes a service that's a direct representation of Firebase
MIT License
4 stars 2 forks source link

Clarify when/why app.import is needed #41

Closed gabrielgrant closed 3 years ago

gabrielgrant commented 3 years ago

The README suggests adding imports to ember-cli-build.js:

  app.import('vendor/ember-firebase-service/firebase/firebase-auth.js');
  app.import('vendor/ember-firebase-service/firebase/firebase-firestore.js');

But (at least when used with ember-cloud-firestore-adapter) this doesn't actually seem to be required. Is that expected? I have a far-from-perfect understanding of exactly how the whole ember build/import resolution pipeline works, so apologies if these are silly questions, but what are the circumstances when adding this is/isn't needed?

mikkopaderes commented 3 years ago

It's explained in the FastBoot section. Let me know if something's not clear.

gabrielgrant commented 3 years ago

Ah, ok -- so the reason we're adding it to the ember-cli-build.js is so that the browser version doesn't get included in the Fastboot build (and then we add the node/Fastboot-specific version via the initializer to be included when run under Fastboot)?

mikkopaderes commented 3 years ago

Ah, ok -- so the reason we're adding it to the ember-cli-build.js is so that the browser version doesn't get included in the Fastboot build (and then we add the node/Fastboot-specific version via the initializer to be included when run under Fastboot)?

It's still included in the FastBoot build but is wrapped in a condition preventing it to run if it detects that it's in a FastBoot environment.

mikkopaderes commented 3 years ago

And to add, ember-cloud-firestore-adapter does the importing for you already, which is why you don't need to do it yourself. You have to remember that this is just a barebones firebase service addon so you import what you use (similar to what the firestore adapter did).

gabrielgrant commented 3 years ago

Gotcha, that all makes sense. Thanks for clarifying -- was mostly just a bit surprised/confused when I realized I had commented out those imports and the app was still working fine