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

add preserveSymlinks option #131

Merged
merged 1 commit into from Jul 26, 2017

Conversation

Projects
None yet
2 participants
@zkochan
Copy link
Contributor

commented Jul 25, 2017

Ref #130

[New]: add `preserveSymlinks` option
Add the possibility to make `resolve` use real paths during resolution.

Fixes #130.

@zkochan zkochan force-pushed the zkochan:master branch 2 times, most recently from 991944d to 0fa967f Jul 25, 2017

@zkochan

This comment has been minimized.

Copy link
Contributor Author

commented Jul 25, 2017

@ljharb could you please review this?

although Travis is failing on some node versions, it doesn't seem to be caused by these changes.

@ljharb

ljharb approved these changes Jul 26, 2017

Copy link
Collaborator

left a comment

Thanks, this looks great - tests should be fixed on master; after a rebase we should be good to go!

@@ -11,6 +12,16 @@ module.exports = function nodeModulesPaths(start, opts) {
// resolving against the process' current working directory
var absoluteStart = path.resolve(start);

if (!opts || !opts.preserveSymlinks) {
try {
absoluteStart = fs.realpathSync(absoluteStart);

This comment has been minimized.

Copy link
@ljharb

ljharb Jul 26, 2017

Collaborator

it is worth noting that this line means that this file will now not work in a browser; whereas i think it would have prior

});

test('sync symlink', function (t) {
var start = new Date();

This comment has been minimized.

Copy link
@ljharb

ljharb Jul 26, 2017

Collaborator

we should be able to use Date.now() here, nbd tho

@ljharb ljharb force-pushed the zkochan:master branch from 0fa967f to de63230 Jul 26, 2017

@ljharb
Copy link
Collaborator

left a comment

I've just done the rebase for you; but perhaps we shouldn't make this be a breaking change by enabling the behavior by default?

@zkochan

This comment has been minimized.

Copy link
Contributor Author

commented Jul 26, 2017

Thanks!

but perhaps we shouldn't make this be a breaking change by enabling the behavior by default?

I think preserveSymlinks should be false by default because that is how Node resolution works by default. If you think this is dangerous or it is preferable to not make breaking changes (I know that this package is very widely used), I am fine to make it true now and then maybe in the future we'll make it false by default

@ljharb

This comment has been minimized.

Copy link
Collaborator

commented Jul 26, 2017

Yeah - let's do that (have it default to true for now) and release a semver-minor.

I'll plan a breaking change in the future that flips it to false - if you'd like to make that PR after this one's merged, I'll rebase and merge it when it's time :-)

@zkochan

This comment has been minimized.

Copy link
Contributor Author

commented Jul 26, 2017

OK cool, I'll push the change in a few minutes

@zkochan zkochan force-pushed the zkochan:master branch 2 times, most recently from 771468e to 3cd8620 Jul 26, 2017

@zkochan

This comment has been minimized.

Copy link
Contributor Author

commented Jul 26, 2017

Changed preserveSymlinks to true by default

Added a notice to README about changing the default value of preserveSymlinks in next major version. It will help me convince users of resolve use preserveSymlinks: false earlier.

@ljharb

ljharb approved these changes Jul 26, 2017

@ljharb ljharb force-pushed the zkochan:master branch from 3cd8620 to fed3f0f Jul 26, 2017

@ljharb ljharb merged commit fed3f0f into browserify:master Jul 26, 2017

0 of 2 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details

zkochan added a commit to zkochan/module-deps that referenced this pull request Sep 2, 2017

Don't preserve symlinks when resolving deps
For context see: browserify/resolve#131

This fixes browserify for projects that use pnpm.
Related issue at pnpm: pnpm/pnpm#795

@zkochan zkochan referenced this pull request Sep 24, 2017

Closed

[Working] Fix pnpm require error [Help needed] #2846

2 of 7 tasks complete

ljharb added a commit to zkochan/node-resolve that referenced this pull request Apr 5, 2018

ljharb added a commit to zkochan/node-resolve that referenced this pull request Apr 5, 2018

ljharb added a commit to zkochan/node-resolve that referenced this pull request Apr 7, 2018

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.