Exclude all directories where your package cannot be found (dist, build, .cache, toolchain, etc).
If you have multiple packages inside a monorepo, use tools to run scripts in parallel and cache the result like nx, turborepo or similar.
Customize the batch value for your project.