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

rexxars
Copy link
Contributor

@rexxars rexxars 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

@rbergman
Copy link

rbergman 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
Copy link
Owner

zertosh commented May 10, 2019

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

@rbergman
Copy link

Thanks!

Copy link
Owner

@zertosh zertosh left a comment

Choose a reason for hiding this comment

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

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;
Copy link
Owner

Choose a reason for hiding this comment

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

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
Copy link
Owner

zertosh commented May 10, 2019

Published the fix as v8-compile-cache@2.0.3

@rbergman
Copy link

Thank you!

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.

TypeError: require.resolve.paths is not a function
3 participants