I want to use npm and JavaScript (or TypeScript) 3rd party libraries directly from the source code.
For example, in Python, I can go directly into the source code make changes in them and see it directly reflected in my application. I want the same functionality with JavaScript because this helps me understand what's going on with my 3rd party dependencies.
I have found the easiest way is to:
https://gitpkg.vercel.app/ helps get the appropriate url to npm install
for a certain folder/commit.
It is also possible to monkey-patch the module from the node_modules
folder.
The main
property of package.json determines what is loaded when a package is imported (is it from a built file in a dist
folder? Just a JS source file?)
Editing the files in node_modules
will have immediate effect, but may be overridden by future npm
commands. Something like patch-package may help make your changes more permanent.
Related references: