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

[Fix] preserveSymlinks: false ensure that files are realpathed #197

Merged
merged 3 commits into from
Jul 31, 2019

Conversation

ljharb
Copy link
Member

@ljharb ljharb commented Jul 30, 2019

Fixes #196.

This very well may not have the correct behavior of --preserve-symlinks-main; I think we'll need some more tests before landing this.

@ljharb
Copy link
Member Author

ljharb commented Jul 30, 2019

cc @bterlson @octogonz

{
"files": "test/resolver/nested_symlinks/mylib/*.js",
"rules": {
"no-throw-literal": 0,

Choose a reason for hiding this comment

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

Instead of throw 'async: no match'; you could just do throw new Error('async: no match');

Copy link
Member Author

Choose a reason for hiding this comment

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

sure, but then the failure output includes a stack trace, which makes it harder to read :-)

@octogonz
Copy link

I tested this in a PNPM repo and confirmed that resolve.sync() now returns the same path as require.resolve() for various inputs that previously were different.

@bterlson
Copy link

This PR looks good to me. It also fixes my original issue with rollup-plugin-node-resolve.

@ljharb let me know how I can help get this in. I'm not at all familiar with the preserve-symlinks-main behavior but I could learn!

@ljharb ljharb mentioned this pull request Jul 31, 2019
@ljharb
Copy link
Member Author

ljharb commented Jul 31, 2019

k, looked into nodejs/node#19911 and replicated its test case; it seems preserveSymlinksMain is only something that applies to node itself, and doesn't need any special handling in resolve.

More test cases would be great, but also the appveyor Windows tests seem to be failing :-/

@ljharb ljharb force-pushed the preserve-symlinks branch 2 times, most recently from 74849a1 to f7da566 Compare July 31, 2019 19:34
@ljharb ljharb merged commit f7da566 into browserify:master Jul 31, 2019
@ljharb ljharb deleted the preserve-symlinks branch July 31, 2019 21:10
ljharb added a commit that referenced this pull request Aug 1, 2019
 - [New] `core`: add `_debug_agent` core module, in node 1 through 7
 - [Fix] `preserveSymlinks: false` ensure that files are realpathed (#197, #195)
 - [Refactor] make `maybeUnwrapSymlink`
 - [Meta] clean up license so github can detect it
 - [Dev Deps] update `tape`
 - [Tests] fix symlinks in windows/appveyor
 - [Tests] up to `node` `v12.7`, `v10.16`, `v8.16`
 - [Tests] gitignore file created in tests; remove it in test setup
@ljharb
Copy link
Member Author

ljharb commented Aug 2, 2019

Seems like this caused rollup/rollup-plugin-commonjs#400 :-/ hopefully we can roll forward instead of reverting

@octogonz
Copy link

octogonz commented Aug 2, 2019

😊 At least it wasn't a PATCH bump!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

preserveSymlinks doesn't work properly from root package
3 participants