-
Notifications
You must be signed in to change notification settings - Fork 142
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
td.replace does not follow node_modules symlinks since v3.3.2 #324
Comments
Yeah, this was caused by 9f51110 and wasn't a foreseen consequence of switching to the built-in In the process of attempting to eliminate the same browserify/resolve dependency from testdouble's dependency quibble, we discovered that there is no |
Thank you @searls for your prompt response and all your work on testdouble 👍 |
I need some help replicating this issue. If you'll look at this branch & example project, and attempt running Can you take a look and adjust it so that it fails? |
Running that test with no modifications actually gives me an exception:
Perhaps its environment/version specific? I'm on:
|
If it helps I've created a simple mono-repo with symlinks that reproduces the problem: https://github.com/arelra/testdouble-issue-324-symlink-module-regression
Which produces the error:
node v6.9.5 |
Hey @arelra, I'm a bit frustrated because I sunk a couple hours into this last night (I'd never used lerna so there were some false starts, and I couldn't understand why this wouldn't work when other symlinked module paths were working fine) based on your statements that v3.3.2 introduced this. I just manually tested your repo against 15 releases (from v1.9.1 forward), and this usage doesn't work with any of them. Can you please provide an example in which your lerna case is actually working? If we can't, then let's call this an enhancement and throw it on the backlog. |
This reverts commit 9f51110. We are reverting because require.resolve() does not currently preserve symlinks unless the entire process is configured to, and that setting cannot be set on the function or once the process is spun up. So, for now we are going to keep using the resolve module. Reference: #324
Hi @searls Thank you for taking the time to look at the problem. I've had a closer look through our codebase and you're right we have previously only td.replaced dependencies that were hoisted by Lerna but not symlinked so this has probably always been an issue. I first saw the exception when trying to replace a symlinked module and v3.3.2 was pulled in which changed the way modules were resolved internally which mislead me. Apologies for not seeing this sooner. Yes please add resolution of symlinks in this scenario as an enhancement. Thanks again. |
Closing in favor of #326. For what it's worth, take care to notice that the root issue likely doesn't have anything to do with symlinks per se, but rather |
Hi,
Since v3.3.2 td.replace() does not appear to follow symlinks in local node_modules.
This is a particular problem when using mono repo tooling such as Lerna
For example:
Lerna will create a symlink for packageB to packageA ie packageB/node_modules/packageA
td.replace does not appear to recognise the path and throws the following exception:
I'm assuming because resolve behaviour was changed recently?
Thanks
The text was updated successfully, but these errors were encountered: