Js-Brecht / gatsby-plugin-pnpm

Provides PNPM compatible module resolvers to Webpack for Gatsby
MIT License
48 stars 6 forks source link

[Feature] add options `strict` and `projectPath` #4

Closed Js-Brecht closed 4 years ago

Js-Brecht commented 4 years ago

This PR adds the following features:

  1. projectPath: Default = process.cwd(). Where is your project located?
    • Sometimes, you might want to resolve modules/loaders relative to a different directory than the one the Gatsby process was started in.
    • Relative paths defined here will be resolved relative to process.cwd().
  2. strict: Default = true. Controls how modules (those defined in include, as well as gatsby itself) are resolved
    • true: Follow pnpm's philosophy of limiting module scope. Tries to find packages in your projectPath's node_modules directory.
    • false: Use Node's module resolution, by using require.resolve(). Will start looking from projectPath, and walk backwards up your directory tree, looking for node_modules. Should also look in your global installs.

Fixes #3