-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conflict between JS module API and Module Unification #16361
Comments
One solution would be to rename So the above example would become: import { createHelper } from '@ember/components/helper';
function myHelper() {}
export const helper = createHelper(myHelper); This can be done in a backwards compatible way by exporting both |
@NLincoln yeah that is a fine approach. We will probably do it in the migrator though: import { helper as buildHelper } from '@ember/components/helper';
function myHelper() {}
export const helper = buildHelper(myHelper); This work should be done in https://github.com/rwjblue/ember-module-migrator |
…xport This fixes the issue described here: emberjs/ember.js#16361 (comment)
A fix for this is released in the module migrator in v0.8.0 |
This change allows the ember-modules-codemod to generate transformed helper files that `import { helper as buildHelper }`. This brings it into alignment with the ember-module-migrator's output. The related change in the module migrator is here: ember-codemods/ember-module-migrator#69 Importing the helper as buildHelper allows the module migrator to `export const helper = buildHelper(...`, which is necessary to avoid an issue where incorrect `export const helper = helper(...` code was being generated. The issue that motived the helper->buildHelper change is: emberjs/ember.js#16361 (comment)
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
function exported by@ember/component/helper
.helper
.The migrator produces code that looks like this:
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.The text was updated successfully, but these errors were encountered: