Misconception: Nx is configuration over conventionĪs you saw in the video, the amount of the generated configuration is small. Many larger organizations using Nx publish a subset of their libraries to their registry. It has 2 applications and a few dozen libraries. Misconception: Nx is for apps, Lerna is for libs.Īlthough it's true to say that the Nx core doesn't care whether you publish your packages or not, there are Nx plugins (e.g., that help you bundle and package your modules.įor instance, the Nx repo itself is built with Nx. It's simply something that Nx can enable you to do at scale. But it's important to stress that this isn't required by Nx. What often happens though is when folks adopt Nx, they have better affordances for implementing a single-version policy (why this is a good idea is beyond the scope of this post, but you can read more about why Google does here). If you want to use Lerna to dedup node_modules in your Nx workspace, you can do it. Nx doesn't care whether your repo has multiple node_modules folders or not, and whether you choose to dedup them or not. Nx isn't a package manager (it's not a JS-only tool), so deduping node_modules isn't in that list. Automatic upgrade to latest versions of all frameworks and toolsĪs you can see, there is basically no overlap.Consistent dev experience for any framework.High-quality editor plugins & GitHub apps.Distributed task execution & computation caching.I can run one command to publish packages to NPM. If I want to test all the projects, I can use a single command to do it. If I use the same version of say Next.js in all the projects, the package is installed once. Lerna, Yarn workspaces, pnpm workspaces offer the following affordances for developing multiple projects in the same repo: Misconception: You have to choose between Nx and Lerna. Basically, any time I say "Lerna" you can substitute it for Yarn or PNPM. Although the video uses Lerna, everything said applies to Yarn or PNPM. The video walks you through the steps of adding Nx to a Lerna repo and showing many affordances Nx offers. In this video I'll compare monorepo tools such as Lerna/Yarn workspaces/PNPM workspaces with Nx.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |