FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Use loader aliases when using require invocations by rajasegar · Pull Request #634 · ember-cli/ember-resolver · GitHub

Repository navigation

Use loader aliases when using require invocations - #634

Open
rajasegar wants to merge 2 commits into
ember-cli:mainfrom
rajasegar:no-conflict
Open

rajasegar wants to merge 2 commits into
ember-cli:mainfrom
rajasegar:no-conflict

Conversation

Copy link
Copy Markdown

Fixes #629

@@ -1,4 +1,4 @@
/* globals requirejs, require */
/* globals requirejs, require, loader */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think we should import require from require, then we'd get the one we want automatically

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Sorry @rwjblue I don't get it, can you please elaborate?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I believe he wants to to import require from 'require'

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 */);
}

jamesarosen Jun 2, 2023 •
edited
Loading

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resolver does not honor the loader noconflict aliases

4 participants


Back | FazBrowse Home | New Git URL