Editing the node modules
A noob method of playing with Node modules
Steps to follow to update code from a node_module like d3-force
directly !!
So what we get in a node_modules are the build folder that dont support HRM (hot reload module) so we have to make changes and then build that folder using the rollup module ( maybe we can use other libs also !!)
Steps:
- Make that change in the file that you want !!(be it debugging statements or logic change )
- Install the required files, using
npm install
and if required change the package manager from yarn to npm - Then lookup to package.json and you might find a function named “prepublishOnly”
- Run the command
npm run prepublishOnly
, If the command requires the some folder , build those or remove those folders from the npm command !! - Then once you fix the errors , got the errors solved , then we build this file using
npm run prepublishOnly
- Then run the development server using the
npm run dev -- --cache
This is how to rebuild a node-module !!
Written on March 26, 2025