rules_js npm benchmarks
Blog post from Aspect Build
rules_js is a Bazel rule set designed for efficient management of npm dependencies, emphasizing performance through fast fetching and linking. It is compared to other npm tools like yarn, npm, pnpm, and existing Bazel rules like rules_nodejs, using a benchmark based on a large Node.js monorepo. The benchmark evaluates both the initial fetching from the internet and subsequent runs using cached packages. While pnpm is noted for its fast lockfile generation due to a content-addressable store, rules_js introduces incremental and lazy fetching and linking capabilities, which can significantly reduce build times in common workflows. Unlike rules_nodejs, which doesn't support incremental linking, rules_js leverages pnpm lockfiles to enable more granular linking of node_modules, enhancing performance for large projects and monorepos. This capability is particularly beneficial for development environments where frequent changes to package.json files occur. Furthermore, rules_js plans to incorporate support for npm and yarn post-1.0, aiming to ease migration from rules_nodejs while maintaining the benefits of incremental and lazy linking.