You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Conflict between JS module API and Module Unification #16361
I discovered an issue while pairing with @wycats that I wanted to write down for future discussion.
We were upgrading an Ember app to use Module Unification that had already adopted the JS module API. The migrator produced invalid code for helpers due to the following conflict:
Helper functions must be wrapped with the helper function exported by @ember/component/helper.
In Module Unification, helpers must be a named export called helper.
One way to fix this is for the migrator to detect this conflict and rename the import (since the export name cannot be changed), e.g. import { helper as emberHelper } from '@ember/components/helper'. But this is something that everyone will have to type, so we may want to think about this conflict and if there are design changes we want to consider.
This can be done in a backwards compatible way by exporting both helper and createHelper from @ember/components/helper, and by mapping both to Ember.Helper.helper in the mappings.
Activity
cursedquail commentedon Mar 12, 2018
One solution would be to rename
helpertocreateHelperSo the above example would become:
This can be done in a backwards compatible way by exporting both
helperandcreateHelperfrom@ember/components/helper, and by mapping both toEmber.Helper.helperin the mappings.mixonic commentedon Mar 13, 2018
@NLincoln yeah that is a fine approach. We will probably do it in the migrator though:
This work should be done in https://github.com/rwjblue/ember-module-migrator
/cc @rwjblue @bantic
Fix an issue with helpers where we re-export the default as a named e…
bantic commentedon Mar 13, 2018
A fix for this is released in the module migrator in v0.8.0
Use buildHelper as localName for Ember.Helper.helper