Use loader aliases when using require invocations#634
Open
rajasegar wants to merge 2 commits intoember-cli:mainfrom
Open
Use loader aliases when using require invocations#634rajasegar wants to merge 2 commits intoember-cli:mainfrom
rajasegar wants to merge 2 commits intoember-cli:mainfrom
Conversation
rwjblue
reviewed
Jan 18, 2021
| @@ -1,4 +1,4 @@ | |||
| /* globals requirejs, require */ | |||
| /* globals requirejs, require, loader */ | |||
Member
There was a problem hiding this comment.
I think we should import require from require, then we'd get the one we want automatically
Author
There was a problem hiding this comment.
Sorry @rwjblue I don't get it, can you please elaborate?
Contributor
There was a problem hiding this comment.
I believe he wants to to import require from 'require'
jamesarosen
reviewed
Jun 2, 2023
Comment on lines
+474
to
+479
| let module; | ||
| if(loader.__aliases && loader.__aliases.require) { | ||
| module = window[loader.__aliases.require](normalizedModuleName, null, null, true /* force sync */); | ||
| } else { | ||
| module = require(normalizedModuleName, null, null, true /* force sync */); | ||
| } |
There was a problem hiding this comment.
This might be a little more resilient if you extracted a variable:
const req = loader.__aliases?.require ? window[loader.__aliases.require] : require
const module = req(normalizedModuleName, null, null, true /* force sync */);
This file contains hidden or 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
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.
Fixes #629