-
Notifications
You must be signed in to change notification settings - Fork 454
Support installed npm modules and relative require #135
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
Changes from 1 commit
ddba1b1
f4e5d39
e853490
75e3a5b
c416f56
83c92d6
3ca4cd5
c1c139b
ade5cea
f57c84a
1f8fc98
d37f92f
7e8659d
7e12bd7
b0e12e7
01f87b6
3ede589
19e7914
4a93ad9
fb7e8f7
5ee517d
256da4e
c758586
b616178
2923e50
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,14 @@ export const wrapRequire = new Proxy(__non_webpack_require__, { | |
apply: (target, thisArg, [moduleID]) => { | ||
if (moduleID.startsWith('.')) { | ||
moduleID = path.join(process.cwd(), moduleID) | ||
return target.apply(thisArg, [moduleID]) | ||
} | ||
|
||
try { | ||
return target.apply(thisArg, [moduleID]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Concern: I feel like the order here of the When using a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah this is a good point. Instead, we should perhaps remove this entire try/catch construct and just do this: const modulePath = target.resolve.apply(thisArg, [
moduleID,
{
// Webpack does not have an escape hatch for getting the actual
// module, other than `eval`.
paths: [process.cwd(), ...eval('module').paths]
}
])
return target.apply(thisArg, [modulePath]) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixing in #136 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! |
||
} catch (err) { | ||
return target.resolve(moduleID, {paths: [...module.paths, process.cwd()]}) | ||
} | ||
return target.apply(thisArg, [moduleID]) | ||
}, | ||
|
||
get: (target, prop, receiver) => { | ||
|
Uh oh!
There was an error while loading. Please reload this page.