Skip to content
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

Expose `require.resolve.paths()` #20

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
3 participants
@rexxars
Copy link
Contributor

commented Mar 30, 2019

As outlined in #17 - overriding require.resolve removes require.resolve.paths from existence. This PR ensures it is proxies as-is.

Closes #17

@rexxars rexxars force-pushed the rexxars:resolve-paths branch from 61c5750 to da27ece Mar 30, 2019

@rexxars rexxars force-pushed the rexxars:resolve-paths branch from da27ece to c6bb7e9 Mar 30, 2019

@rbergman

This comment has been minimized.

Copy link

commented May 10, 2019

@zertosh Is there any hope of getting this merged and released? It's a terrific module that benefits our application's performance significantly, but breaks the node SDK in this one small but important way. I have a potential workaround to monkey patches the gap, but it's much uglier than this actual fix.

@zertosh

This comment has been minimized.

Copy link
Owner

commented May 10, 2019

Let me take a look at re-syncing _compile from core to the latest version.

@rbergman

This comment has been minimized.

Copy link

commented May 10, 2019

Thanks!

@zertosh
Copy link
Owner

left a comment

New PR coming up

@@ -161,6 +162,7 @@ class NativeCompileCache {
require.resolve = function(request, options) {
return Module._resolveFilename(request, mod, false, options);
};
require.resolve.paths = resolvePaths;

This comment has been minimized.

Copy link
@zertosh

zertosh May 10, 2019

Owner

paths depends on the calling module: https://github.com/nodejs/node/blob/v12.2.0/lib/internal/modules/cjs/helpers.js#L26-L29

As-is, every module that uses require.paths would be doing so using the v8-compile-cache's require.paths - not the one unique to them.

@zertosh

This comment has been minimized.

Copy link
Owner

commented May 10, 2019

Published the fix as v8-compile-cache@2.0.3

@rbergman

This comment has been minimized.

Copy link

commented May 10, 2019

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.