DEV Community

Cover image for Adding Edited Node Modules to the deployment.
Pankaj Singh
Pankaj Singh

Posted on

Adding Edited Node Modules to the deployment.

What is problem with editing the node modules?
Let's say you want to make changes to a module and you got that file and make changes and everything seems to work fine in localhost. But when you push the website to github, the node modules do not do get uploaded. So when the website is deployed you might face errors.

The way to tackle this issue one can something like a patch-package.
patch-package allows you to modify the code in the node_modules` directory, in the form of patches. The usage was quite simple too.

Install the patch-package module.

npm i patch-package

Make changes to the node-module locally.

Now to make a patch of any of the node module, run the following command

npx patch-package 'module-name'

This will make a patches folder containing the patch of the specific module.

Image description

Now if you push the repo to deployment, you will find everything working fine.

Thanks for reading. Do like the post and do share your thoughts in the comment section.

`

Top comments (0)