-
Notifications
You must be signed in to change notification settings - Fork 32
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
Can only run the codemod on a file once #195
Comments
Yikes, this is pretty odd. I've not run into this myself, do you know if it is specific to your project or does it happen even on other projects? |
I investigated a bit more and it only happens if I install the codemod globally. Guess I just should not do that then. 😁 |
That is good info though, should help us reproduce... |
might be related to : #104 (comment) |
Same issue. Different codemod -
While running via
My env:
Source code of given component: https://gist.github.com/MichalBryxi/ba67cb77bd94c6b973f62676152aa175 |
I've been running into the same thing after it has been recommended to me that I should install the codemods locally in order to not have to download and install chromium each time I run a codemod (which is very time consuming). |
Same thing here with the UPD In theory we can omit this |
Found a very weird solution: the problem disappeared when I installed the
I guess I'd stop digging here until I face it again. BTW, found the related issue on babel itself babel/babel#9657 |
I encountered the same problem and did a bit of debugging I was able to monkey patch it somehow: I cloned the codemod repo, installed dependencies and then manually altered index.js in convert-source-map dependency:
after
After this change, everything works fine... |
@IgorKvasn Thank you for your suggestion. In order to get this addon working locally, I had to use
|
This bug is unbelievably haunted. From safe-buffer/index.js: if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
module.exports = buffer
} else {
// Copy properties from require('buffer')
copyProps(buffer, exports)
exports.Buffer = SafeBuffer
} The problem seems to start from the first branch, where the native Buffer API is good to go so it just re-exports it.
👻 This behaved the same way in several old node versions; I stopped testing when I got to the 10.x LTS. I wonder if Babel is doing something really weird with things that do As for why the codemod works right once and then never again, ??!?! I hate this. Related art: react-static/react-static#875 |
I suspect the issue here at least partially relates to a failed parse due to invalid syntax. Once the failed parse has occurred I think something happens to the require cache that screws the other runs. |
When I run the codemod on a file the conversion to the angle brackets syntax works fine. But when I discard the changes and try to run the codemod again I get this error:
Do you know what's causing this?
(I'm running WSL2 with Ubuntu 18.04 on Windows 10 build 19023)
The text was updated successfully, but these errors were encountered: