Reducing internal usage of AMD loader #20582
Merged
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 is re-opened from #20581. I merged that one prematurely and immediately force-pushed to revert it.)
There are several places where ember-source depends unnecessarily on details of the AMD loader:
optionally loading the ember-testing implementation
optionally loading the runtime template compiler
This PR replaces them with more direct forms of coordination via module-scoped state.
My overarching goal here is to eliminate all usage of require inside the actual ES module packages so they are true ES modules.
In contrast, the traditional ember.js, ember-testing.js, and ember-template-compiler.js bundles will still use require as their implementation to maintain backward compatibility. Where we need to patch over the weirdness of this (from the perspective of actual compliant ES modules), we do so entirely within the build that produces the bundles.
This is a step toward the proposed strict-es-modules optional feature. This implementation cleanup is happening before advancing that RFC because this cleanup is good either way and does not make any public API changes.