Bizon4ik
Bizon4ik

Reputation: 2764

React.js + webpack: build own library for several projects

I have react.js application that is built by webpack. Inside this project, I have some components that I wish to reuse in another react.js project. At the very beginning, I just made copy-paste. However, I realize that it was a bad idea because these components are alive and updated from time to time. And after each update, I wish to have the same changes in another project. So the solution is obvious, I have to make some lib which will contain my components that all project should depend on this lib. The question is how to make such kind of lib? In view I a newbie in react and webpack, it would be nice to have step instruction or link where I can find some kinda tutorial

Upvotes: 2

Views: 205

Answers (1)

pizzarob
pizzarob

Reputation: 12049

You can use yarn workspaces to do just that. This allows you to develop locally and include local packages as you would a package on the npm registry.

Upvotes: 1

Related Questions