Skip to content

Instantly share code, notes, and snippets.

@trabus
Last active August 24, 2018 15:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trabus/99ea40c9c12235343588 to your computer and use it in GitHub Desktop.
Save trabus/99ea40c9c12235343588 to your computer and use it in GitHub Desktop.
Handling addons with conflicting module names

Say that you have some-addon and other-addon, and both have a foo service, and both export app/services/foo.js.

What you would observe is that other-addon would win over some-addon providing the foo service in your consuming app, because modules are resolved alphabetically.

To get around this, you can essentially proxy the services in your app folder, like so:

// app/services/foo-a.js
export { default } from 'some-addon/services/foo';
// app/services/foo-b.js
export { default } from 'other-addon/services/foo';

Then consume in your app with the new name:

// app/component/foo-bar.js
...
  fooA: Ember.inject.service('foo-a'),
  fooB: Ember.inject.service('foo-b')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment