-
-
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
Refactor the internal Ember loader to use the standard Ember CLI loader #19390
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b059b42
to
b99fa0f
Compare
rwjblue
reviewed
Feb 9, 2021
This PR refactors the internal Ember loader so that it uses the standard Ember CLI loader instead for modules. This means that modules will be defined in the main namespace, and importable from there, instead of in a hidden namespace that only Ember can use. Notes: - Code is still loaded and built via `treeForVendor` and included as a vendor file. This needs to be the case for the time being for bootstrapping. - Loader code is still included for Node support. If `define` and `require` are not already defined, then a backup shim is used instead. - Modules are now exposed from Ember, but `ember-cli-babel` still transpiles them to global references. This unblocks us from being able to make all modules work normally, however. - `require` shim module is no longer defined, we reference `define` and `require` as globals instead (which is more accurate). In the future we should update this to use Embroider's conventions. - `__loader` is still exposed on the Ember object, referencing the same values as before.
b99fa0f
to
be324d1
Compare
rwjblue
reviewed
Feb 10, 2021
Comment on lines
+21
to
+24
if (typeof globalObj.define === 'function' && typeof globalObj.require === 'function') { | ||
define = globalObj.define; | ||
require = globalObj.require; | ||
|
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 we might need to accommodate the no conflict APIs for loader.js
here
https://github.com/ember-cli/loader.js#no-conflict
Since loader
doesn't expose loader.require
/loader.define
or a way to access what the "new" aliases are we can't do this just yet.
rwjblue
approved these changes
Feb 10, 2021
This was referenced Feb 11, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR refactors the internal Ember loader so that it uses the standard
Ember CLI loader instead for modules. This means that modules will be
defined in the main namespace, and importable from there, instead of in
a hidden namespace that only Ember can use.
Notes:
treeForVendor
and included as avendor file. This needs to be the case for the time being for
bootstrapping.
define
andrequire
are not already defined, then a backup shim is used instead.ember-cli-babel
stilltranspiles them to global references. This unblocks us from being able
to make all modules work normally, however.
require
shim module is no longer defined, we referencedefine
andrequire
as globals instead (which is more accurate). In the futurewe should update this to use Embroider's conventions.
__loader
is still exposed on the Ember object, referencing the samevalues as before.