reactjsshared-libraries

Internal private React library


Is it possible to set up a library in React without publishing it on npm?

I need to remove some components of one application to a separate library so it could be used in two different internal projects, but all the guides I found about making react libraries ended up publishing the library on npm. Is there any way of sharing this code without being a copy and paste of code, but at the same time, not having to publish it on a public network?


Solution

  • Yes, you can avoid publishing on npm by installing the package directly from a GitHub or GitLab private repository. Simply use the command: npm install <git remote url>.