This is the most crucial part of the whole setup. I am prefixing all packages' names with they will be distinctive from the official npm registry. And I want both apps to hot reload whenever I edit a file inside the UI library.īy independent I mean that app1 doesn't know anything about app2 and vice-versa.īelow is a setup that is compatible with npm 7 workspaces. Let's say I want to build two independent React apps called app1 and app2 that will use a common component from a common UI library called ui. I just want that nice button in my app too You can jump from project to project without switching windows on your desktop. It would be nice to extract that UI in form of React components and prepare building blocks that are ready to use for all members of the team.Īpart from that it's just more convenient to have all your source files opened in a single IDE instance. Imagine a team that develops two React apps that shares some common UI elements like inputs, selectors, accordions, etc. The most common reason to set up a monorepo is to streamline work within a dev team that maintains multiple apps that are using a shared piece of code, for example a common User Interface library. Read on and you'll find out how to use npm 7 workspaces in a real-world scenario and learn that using workspaces the npm's way is very different to yarn's.Ī monorepo is a term describing a single git repository that contains many projects. To use yarn or pnpm you have to take an additional step and install them first. Why is it big news? Because npm is the only package manager that comes bundled with every NodeJS. This month npm has released a major version of their package manager npm 7.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |