Vendor a dependency in a monorepo
Copy a third-party package into a workspace folder, keep its license, and depend on it with workspace:* so apps use your patched copy. pnpm 10.
Sometimes you need to patch a small package right now and cannot wait for upstream. Vendoring means copying its source into your monorepo as a workspace package, which you then own.
{
"name": "@acme/vendor-pad",
"version": "1.3.0-acme.1",
"type": "module",
"exports": "./index.js",
"license": "MIT"
}export const pad = (s, n) => String(s).padStart(n, " ");{
"name": "web",
"type": "module",
"dependencies": { "@acme/vendor-pad": "workspace:*" }
}import { pad } from "@acme/vendor-pad";
console.log(`[${pad("ok", 5)}]`);[ ok]Keep the original LICENSE file and a short note about where the code came from and what you changed, since the license requires attribution. Pnpm links the folder through the workspace protocol.
You are now the maintainer. Security fixes upstream will not reach you, so write down the upstream version you copied and review it when you update other dependencies.