简体   繁体   中英

How to customize code of existing installed module

I am using an Angular2 module which provides me with a custom tag input field ( angular2-tag-input module), but I would need some feature in the input the module doesn't provide.

As this feature is quite specific to my project, it wouldn't fit as a pull request for the developer.

So what I would like to do is customize the module locally, how can I do that? I tried changing the code directly in node_modules/blabla/dist/ but it doesn't seem to work... Webpack is detecting my changes (it rebuilds everytime I save the files) but the website content doesn't reflect my changes. Furthermore, this technique wouldn't be compatible with git, as the node_modules are untracked files, specifically installed on each workstation regarding the yarn.lock dependencies file...

This is not a question about angular modules but rather a question about npm modules. There are several ways to do

First clone locally the git repository of the module you want to customize, make your changes.

Then to integrate it in your JHipster app, there are few alternatives:

  • use yarn link or npm link , this is often what modules developers do for testing locally and is usually described in their contribution guidelines
  • push your clone to github.com or to any other git server, then edit your package.json to specify a git URL as the source of your module dependency
  • build your npm module and publish it to an internal npm registry

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM