Brendan Dash

Brendan Dash

pnpm shamefully-hoist configuration

shamefully-hoist#

https://pnpm.io/npmrc#shamefully-hoist

By default, pnpm creates a partially strict node_modules structure, meaning dependencies can access undeclared dependencies, but modules outside node_modules cannot. In this layout, most packages in the ecosystem work fine. However, if certain tools only work when dependencies are hoisted to the root of node_modules, you can set this option to true to hoist those dependencies for you.

In simple terms, if there is a module A that depends on module B, and module A is depended on in the project's package.json, module A can access module B, but the project cannot. When shamefully-hoist=true, module B will be hoisted, making it accessible in the project.

By default, pnpm only exposes dependencies specified in package.json in node_modules, unlike npm, which exposes dependencies including dependencies of dependencies.

.npmrc

shamefully-hoist=true

hoist-pottern#

hoist-pattern[]=*eslint*
hoist-pattern[]=*babel*

Hoists a dependency to node_modules/.pnpm/node_modules where it cannot be referenced externally.

public-hoist-pattern#

public-hoist-pattern[]=['*eslint*', '*prettier*']

Places dependencies in the root node_modules directory, allowing them to be referenced from the root directory.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.