Skip to content
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

Fix Ember.emberDeprecate is not a function #540

Merged
merged 2 commits into from
Feb 11, 2021

Conversation

alexlafroscia
Copy link
Contributor

The internal deprecate wrapper imports Ember's deprecation utility from a different location than the documented one.

When running this addon against the latest version of Ember, a runtime error occurs where Ember's deprecation function is not defined.

deprecate documentation: https://api.emberjs.com/ember/3.24/functions/@ember%2Fdebug/deprecate

The internal `deprecate` wrapper imports Ember's deprecation utility from a different location than the documented one.

`deprecate` documentation: https://api.emberjs.com/ember/3.24/functions/@ember%2Fdebug/deprecate
For some reason, the Ember Babel plugin isn’t working when we re-name the `deprecate` function while importing; it results in the code being converted into

`Ember.emberDeprecate`

Rather than

`Ember.deprecate`

And that function is, understandably, not defined.

I thought the issue might be the dated version of `ember-cli-babel` but updating that doesn’t seem to actually solve the problem.
@alexlafroscia alexlafroscia changed the title fix: import deprecate from documented module Fix Ember.emberDeprecate is not a function Feb 10, 2021
@alexlafroscia
Copy link
Contributor Author

For some reason, when the deprecate import is renamed through the import, the Babel plugin breaks. It converts the function into Ember.emberDeprecate rather than Ember.deprecate.

At first I thought that this was all caused by importing from the wrong module (my first commit) but that didn't actually fix the problem.

I then figured this would be a bug in ember-cli-babel since the version used here is really old. However, I updated the dependency and that didn't fix the issue.

Just avoiding the alias while importing does fix the problem so... I guess we'll do that? 🤷‍♂️

@alexlafroscia
Copy link
Contributor Author

Interestingly, it seems like the @ember/debug modules are handled as a special-case in ember-cli-babel...

https://github.com/babel/ember-cli-babel/blob/76876904812fee227fff2af1e29aca73cf6f1c76/node-tests/addon-test.js#L113-L136

I wonder if that is related to the fact that the alias on importing seems broken.

@alexlafroscia
Copy link
Contributor Author

alexlafroscia commented Feb 10, 2021

Oh hey, here's the actual bug

ember-cli/babel-plugin-debug-macros#48

Also called out on the ember-cli-babel bug tracker, but the PR that was started as a fix never landed

emberjs/ember-cli-babel#372

@ro0gr
Copy link
Collaborator

ro0gr commented Feb 10, 2021

Hey, thanks for the fix and info!

I'm going to merge and publish it, once CI passes.

@ro0gr
Copy link
Collaborator

ro0gr commented Feb 10, 2021

Recently I had to do a similar change to the v2-beta branch 2d7ea1b, but I didn't realize we do use an invalid import path. Will fix it there as well.

@ro0gr
Copy link
Collaborator

ro0gr commented Feb 11, 2021

alright, travis build has failed for ember-beta scenario due to a monstrous amount of deprecations, and maximum log length 😋
seems I'd need to cleanup some of ember deprecations to make Travis a bit more happy. But not today.

@ro0gr ro0gr merged commit 2ef91c8 into san650:master Feb 11, 2021
@ro0gr
Copy link
Collaborator

ro0gr commented Feb 11, 2021

published as 1.17.7. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants