ember.js
ember.js copied to clipboard
[Bug] Service injections doesn't work with `index` files
π Describe the Bug
In most other places, you can equivalently have foo.js
and foo/index.js
(except in controller and routes where "index" has a special meaning) and expect things to work. However, if you have app/services/foo/index.js
instead of app/services/foo.js
you will get an error. Seems like we should be able to make it work?
π¬ Minimal Reproduction
- Create
app/services/foo.js
- Inject it into a component or something else
- Observe that it works
- Rename the service to
app/services/foo/index.js
- Observe that it doesn't work
- Add back
app/services/foo.js
and re-export from the index file manually - Observe that it works
π Actual Behavior
Step 5 throws an error.
π€ Expected Behavior
Step 5 should Just Workβ’.
π Environment
- Ember: 3.26
- Node.js/npm: -
- OS: -
- Browser: -
I've reproduced in ember-source 5.1.1 here https://github.com/elgordino/service-injection-index
Subscribing since I'm interested in a fix