Это видео недоступно.
Сожалеем об этом.
patch-package | Fix broken node modules instantly
HTML-код
- Опубликовано: 9 мар 2020
- patch-package is a tool that has saved me a couple of times when I found a bug in an npm package and needed to fix it ASAP.
Code: github.com/ben...
Links from video:
github.com/ds3...
----
Follow me online: voidpet.com/be...
#benawad
Wow, i was looking for something like this since forever. Thank you Ben for recommending this tool.
I've been using this for a while now in our design system, it's super awesome. Although, be careful of using ^ version installs as the patch doesn't get correctly applied if you get a few patch bumps, happened to me today and app teams had a broken version of a menu drop down... 😬
Incredibly useful package for larger NPM packages, especially some with bad coding practices. I needed to use this for MedusaJS (among the worst coding practices I've ever seen) to stop verbose logging of EVERY request made to the API that isn't disabled, even in production.
Thank you, i've been looking for this the whole time, straight to the point!
Yeah patch-package is amazing! I needed it for Typescript conflicts between dependencies 😍
Thanks for recommending this tool. I remember watching this video near release data and it's only now I need it. TY.
Dose this help when i want to fix some package per deep version to be compatible to react 18
Yup ... I even used it for my own package recently because it's so much faster :D
I've known about this for some time, but haven't used it. Actually, I forgot about it (thanks for the reminder). Love the walk through...super helpful and now it's more likely I'll remember this when I need it. Thanks!
I think yarn 2 will have a "patch" protocol, which you can use to modify files in node modules. But on the other hand, this seems much easier and cleaner than doing it using "yarn patch"..
A helpful VSCode plugin is 'Format Toggler' which enables toggling 'format on save' via single click on the status bar.
I haven't found a use for this until today due to firebase and reactfire. It's doing "import * as firebase from 'firebase/app'" instead of "import firebase from 'firebase/app'". Thanks for this!
Thank you, "postinstall" was what I was missing
this is awesome! thank you for making a tutorial on it. your a rock star!
This is a lifesaver. Great video.
Thank you Ben. I really enjoyed the way you explained it.
dev: "cool! what happens if I try to fix node?"
*runs patch-package npm*
*npm removes itself*
dev: it worked!
My god... This is so helpful!! Thank you!!!
Used to replace them with node fs in postinstall pretty similar but patch-package really neat.
Thanks man! I've been thinking of a package like this a month ago!
Thanks, Ben! It was really helpful!
Thank you, Ben! Very informative
Thanks I had to do the same and was looking for some experience!
Thank you very much for this 👌🏽
I've used this library before, it's great for fix things fast! But you can also use the fork from the PR if there's any
True, you can just link directly to the github repo in package.json. I did this recently; worked well. Only issue I ran into was that I had to go into the module under the node_modules dir and run `yarn install`, in addition to the `yarn install` at the top-level.
great video, noticed a peculiar case, if you want to patch a package by installing another package for that specific package. looks like that can't be patched. anyone know how to go around something like that?
Dose this help when i want to fix some package per deep version to be compatible to react 18
Very useful, thank you!
You just made my day!
amazzzzing. thank you so much
Super useful man. Thank you!
Thank you. Very helpful.
Much thanks man
Thank you Ben!
alternatively, fork library, apply fix, use git url
Helpful Video.. Thank You
Thanks for the video. Sadly I am having trouble with my Privider.js file in my node_modules. I do not know what to do. I just hope I can debug it soon.
Hmmm, not sure this is the easiest way to use patch-package. You can just edit the package directly in node_modules and run patch-package name-of-package and it creates a diff file for you without having to search or console log anything.
Yeah that's what I did, but sometimes you don't know which JavaScript file to change in the package
Ty very nice tool.
THANK YOU!!!!
thanks a lot Ben!
thanks!
What is the autocomplete I just saw on your terminal?
default for fish shell benawad.com/fish
Ben Awad thanks
It's good to see such a package. But is it the only use case of this package.
Great really handy !
why u removed vim extension bro ?
hehe nice catch, vim plugin dies on large files so I disabled it for this video
I'm wonder if u gonna share your thought about NextJS SSG here on youtube! according to your former interesting contents about JAMStack.
yes, that's coming soon!
isn't it better to just fork the repo?
Hi Ben, what is your ohmyzsh theme?
gruvbox
1000 like brother
Please create series of redux in react native with navigation and axios in that
Great video as always. Add a link to it in an article of mine covering multiple techniques to fix broken packages: medium.com/p/d8f808657d8e/
If patch-package somehow worked with TypeScript and build systems that would be even better. Seems like an easier solution in this case is to use the forked repo in your package.json, or it breaks due to build steps?
Can’t you just use the git URL as the version in package.json?
yeah if the project is simple, that can sometimes work
Ben Awad Since you decided to patch a known version, knowing that version in package.json is by no means telling the truth anyways.
Instead of spinning off your own fork and publish an npm package, or keeping a local patch, I suggest using the SHA URL of the PR source branch directly in your package.json. That’s less lying and less artefacts to maintain.
Vicary A that will not work when the source is compiled (like typescript).
Felix Leupold Please enlighten me, I am honestly not sure if you can correctly patch a bundled script though.
Idk man this doean't seems to be viable solution.in my case react spring had really nasty memoryleak so people asked them for fix and they made beta version for that till next LTS release .for other packages shouldn't be diffrent if maintainer is active
this is for when the maintainer is slower
Have you tried using Yalc (github.com/whitecolor/yalc)? I've been using Yalc for this particular use-case but will try using patch-package to see if it's faster. Nice videos - keep them coming :)
I haven't, looks nice though
yeiit
im early af