-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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] supply sourceRoot as default, solves symlink issues #3207
Conversation
Current coverage is 85.40%
@@ master #3207 diff @@
=======================================
Files 193 197 +4
Lines 9385 12175 +2790
Methods 1068 0 -1068
Branches 2162 2504 +342
=======================================
+ Hits 8230 10398 +2168
- Misses 1155 1213 +58
- Partials 0 564 +564
|
What is the status on this PR? |
@Swaagie Thank you for contributing! It needs to be reviewed, when people have the opportunity. Can you please provide a minimal reproduction that demonstrates what this is for without Webpack in the picture? If this were to move ahead there should be some new tests, correct? Whoever else reviews this: I'd like the chance to review it before it gets merged if someone else doesn't decline it first. |
I'll provide a minimal reproducible case through tests. That said I don't like pushing symlinks into repositories, but i'll check if I can get it to reproduce without symlinks. Also this isn't about WebPack. It just so happened that the bug was found there. This should be reproducible without webpack as well, any symlink outside the root folder would do... |
I would love too see this merged.. just ran into this issue. I am using npm link to create symlink from node_modules to another package which I still need to get processed via babel and this PR make it work for me. |
Actually I was able to reproduce it without symlink - just requiring file outside of the root folder. require('../../folderOutside/component.js') |
And seems that this fix does not cover situation when required file outside the root requires files which is back again inside root. I know its bit unusual situation - we ran into it while some refactoring... |
Sorry for the holdup, had a familiy addition 👶 to attend to last week ;) Working on it today |
Just want to pitch in that I'd love to see this fix. If there's anything I can help with would be happy to! |
Finally managed to add a test against this option. Let me know if additional work is required |
Tests failing due to |
What is the current status of this PR? |
Hello @Swaagie. Thank you for providing additional information. I'm removing the |
@jmm thanks for getting back to this, I'm fine if the solution is applied elsewhere. From my perspective this seemed like a logical point of entry. Using the local input path will ensure the symlink is not taken as source for discovery of the presets. |
@Swaagie Usually we recommend people do:
? |
@loganfsmyth sure thats the current 'hotfix', I'm aware of that, however this is not really about directly providing sourceRoot. That option is set by default from babel-loader through webpack. Hence the DX becomes just providing |
Is additional information required for this to land? Would happy to follow up or change whatever is needed |
Hello @Swaagie. We'll keep you posted when additional information is required. Please understand that periods of inactivity generally mean that people haven't had the opportunity to review / discuss and respond -- there's no specific timeframe. But we are aware that there are open PRs. Babel doesn't have a policy requiring this, but in future situations I'd suggest considering opening an issue before a PR that very clearly explains the problem in the context of Babel, very preferably with a minimal reproduction that can be cloned and run and without relying on external dependencies like Webpack, and if you have an idea about a solution include that as well. Discussion about possible solutions can happen there before putting the effort into a PR. This is one of several PRs that have been submitted, using several different approaches I believe, that are trying to fix an issue originating from It sounds like you're saying this approach relies on I think the approach in this PR will break stuff. For example, see the tests I added in #3196. If you add |
Closing for inactivity. Babel 7 resolving via cwd #5466 should fix symlink issues |
hmm, |
This fixes babel/babel-loader#166 and babel/babel-loader#149. Afaik the
sourceRoot
is available in options and has correct absolute path.