-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
Feature request: add preserveSymlinks
option to require.resolve()
#18009
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
Comments
I'm fine with this. I had suggested this previously and it wasn't too popular at the time -- but at that time there was no options argument on |
Something like this commit should do the trick. It would need benchmarked and documented though. EDIT: module benchmark results:
|
I prefer adding an object as the argument for specific options which there is now already the Any plan on adding preserveSymlinks option ? |
@cjihrig Any chance we could see the changes in your commit turned into a full PR? I think many people would greatly benefit from the added options. Having to rely on third-party packages that attempt to mimic the behavior of the node resolution algorithm is considerably less than ideal. |
Any news on this? It would be very beneficial for one of my projects. I have to rely on a third-party package that just recreates part node's functionality, and it feels fragile. |
There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment. For more information on how the project manages feature requests, please consult the feature request management document. |
There has been no activity on this feature request and it is being closed. If you feel closing this issue is not the right thing to do, please leave a comment. For more information on how the project manages feature requests, please consult the feature request management document. |
This would be a useful feature. For now the resolve package can be used instead, which has the |
According to the docs, the only option currently on
require.resolve(path[, options])
ispaths
. I have a project that I'm trying to eliminate a dependency on browserify/resolve, and the only thing holding me back is that my library needs to know the resolved path of a given string while preserving symlinks, regardless of whatever the end-user has set their global Node environment to.I propose a second option be added to this method named
preserveSymlinks
which behaves the same way as the --preserve-symlinks CLI flag and ENV var, but is local only to the call onrequire.resolve()
.I attempted to work around this by changing the
NODE_PRESERVE_SYMLINKS
env var at runtime, but it had no effect.If this seems like an agreeable enhancement to
require.resolve
, I'd happily take a stab at a PRThe text was updated successfully, but these errors were encountered: