Choosing pnpm’s Package Hoisting Strategy: Strict, Shamefully‑hoist, or Selective
Learn how to pick the right pnpm hoisting mode for your Node.js project, compare disk usage and compatibility, and apply the setting with verification steps.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Learn how to pick the right pnpm hoisting mode for your Node.js project, compare disk usage and compatibility, and apply the setting with verification steps.
Npm workspaces provide a convenient way to manage monorepos, automatically hoisting dependencies to the root node_modules where possible. However, when two workspace packages depend on different versions of the same transitive dependency, the client must decide where to place that dependency. The algorithm that drives this decision is documented in the npm w
A pnpm workspace stores packages once in a content-addressable store and creates per-project node_modules via symlinks. Strict isolation preserves deterministic resolution and disk efficiency, but changes resolution paths compared to a flat layout. Selective hoisting via public hoist patterns and node linker options can expose specific packages at the worksp
Goal Determine how Yarn resolves peer dependencies when multiple workspaces share a common peer, and whether hoisting or nohoist directives affect runtime resolution. Constraints & Uncertainty In Yarn 2+ (Berry) the Plug'n'Play mechanism eliminates node_modules, yet workspace-level hoisting still occurs according to the highest compatible version. The "n
Dependency Resolution and Hoisting in pnpm pnpm utilizes a content-addressable store and a non-flat node_modules layout to prevent phantom dependencies. By default, only direct dependencies are accessible at the root of node_modules , while transitive dependencies are isolated within the .pnpm virtual store. However, certain legacy tools and bundlers expect
Diagnose whether Jest mock hoisting behaves consistently for ES modules when tests import mocked bindings using namespace syntax. Jest hoists jest.mock() calls above imports to allow module mocking, but ES module interop changes evaluation order. It is uncertain whether behavior is consistent across supported Jest versions, and whether top-level mock state p