'Changing code in existing node module
I have vue.js project with element-ui. All installed via npm. Now I want to change something in element-ui just to test if it works so I go in it's folder in node_modules, change code in component, run 'npm run dev' and change is not visible.
Is it in some kind of cache?
Sorry for dumb question but I am node.js noob. How can I update existing code in node_modules? I know when I run update it will go away but I just want quick test.
Do I really have to fork for that?
Solution 1:[1]
If you check the main entry in the package.json, in this case it's "main": "lib/element-ui.common.js". The problem can be that you've modified one of the files in the ./src folder that won't be picked up automatically until you recompile the package.
I think you should clone it's github repo, build the package and overwrite the installed one in your package's node_modules folder.
It is possible if you run npm install these changes will be overwritten from NPM and you have to copy it again.
Solution 2:[2]
you can change the code(example, botton.js) directly in node_modules. Note that the file (botton.js) is located in modules_name/lib/*
I have tested, it work.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Lajos Gallay |
| Solution 2 | steveyzhang |
