-
-
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
Deprecate window global #19357
Deprecate window global #19357
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will also need a couple of tests
So had a quick convo with @rwjblue about this, and we realized we're going to need to make some additional changes. Currently, So, in this package we need to add the Ember package so you can actually import it. In the babel plugin that |
e0fdb0f
to
bc14af2
Compare
Next Steps?:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to land we need to:
- Update https://github.com/ember-cli/babel-plugin-ember-modules-api-polyfill
- Add a new configuration option (
useEmberModule
maybe?) to opt in to emitting theimport Ember from 'ember';
bit or doing the (currently default) "just usewindow.Ember
" thing
- Add a new configuration option (
- Update ember-cli-babel
- to use that new version of babel-plugin-ember-modules-api-polyfill
- to pass
true
orfalse
to that new option based on the running version ofember-source
- Update this PR to actually emit a
ember
module (current Ember apps actually have noember
module at runtime, we have to fix that)
packages/ember/index.js
Outdated
Object.defineProperty(context.exports, 'Ember', { | ||
configurable: true, | ||
writable: false, | ||
get() { | ||
return Ember; | ||
}, | ||
}); | ||
|
||
return Ember; | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I don't think we should redefine it. If we do, then you won't have a deprecation for every usage of Ember
without importing (you'd only get on deprecation). This would make finding and fixing any global accessing quite difficult.
packages/ember/index.js
Outdated
}, | ||
}); | ||
|
||
context.exports.Em = context.exports.Ember; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one also needs to be Object.defineProperty(context.exports, 'Em'
with a deprecation
Aren't there some important parts that have not been exposed via modules yet? How would that work with this? |
@btecu as noted in the RFC, you will still be able to |
babel plugin: ember-cli/babel-plugin-ember-modules-api-polyfill#175 |
@NullVoxPopuli can you rebase this PR? Now that #19390 has landed, everything should be much easier to deprecate since the global is now setup lazily (you can do it in |
… window.Ember RFC: emberjs/rfcs#706 tl;dr: Recommend `import Ember from 'ember';` instead of using the window.Ember global
bc14af2
to
5534e7f
Compare
https://github.com/ember-cli/babel-plugin-ember-modules-api-polyfill/releases/tag/v3.3.0 includes new |
This has been superseded by #19457, so can be closed, right? |
No description provided.