
Security News
Open Source CAI Framework Handles Pen Testing Tasks up to 3,600× Faster Than Humans
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
gatsby-plugin-pnpm
Advanced tools
This plugin will configure Webpack module & loader resolution for packages installed
via pnpm
.
When using pnpm
, building a Gatsby project will fail because pnpm
uses a unique
node_modules
structure, and webpack
doesn't know how to resolve packages in it.
This plugin will configure webpack
so that it is able to see Gatsby
's dependencies.
gatsby-config.js
.// gatsby-config.js
module.exports = {
plugins: [
...,
`gatsby-plugin-pnpm`,
...
]
}
That's it. You should be able to build now.
include
- define custom resolutionsVariations:
Add resolution for specific package
Sometimes, Webpack may need to resolve a module that is a sub-dependency of one of your
project's dependencies, and due to the way Webpack resolves modules (and sometimes because of
the way those modules are written), it won't be able to. If this is the case, we need to point
Webpack the way to where those sub-dependencies are located. To do that, please include your
dependency in question in the include
plugin option described below.
strict
option is true
, then the package you define in this manner MUST
be one of your project's direct dependencies, because it will be resolved using your project's
node_modules
directory.add resolutions for directories
There are also times where you want Webpack to be able to resolve modules in a directory that
is not a part of any of your dependencies node_modules
. If that's the case, please include
the directory path in the include
option described below.
process.cwd()
.projectPath
- define your Project Rootprocess.cwd()
.process.cwd()
. In
that case, please define the projectPath
option described below.
process.cwd()
,
which may not be desired if you're using this option in the first place.strict
- module resolutiontrue
.true
: Keep with the pnpm
philosophy of scoping modules to your current project.false
: Use Node's module resolution. This causes node_modules
to be checked walking backwards up
your directory tree.Option | Description |
---|---|
include | OPTIONAL: A list of package names and/or paths that you would like to be made available to Webpack. Each of these should either be the name of one of your project's direct dependencies, or a path to a folder containing packages that can be resolved as a module. |
projectPath | OPTIONAL: The path to your project; i.e. the folder containing your package.json . This will be used when locating package names defined in include , and for resolving your project's node_modules directory |
strict | OPTIONAL: Defaults to true.true = Resolve modules using the pnpm philosophy of limiting the module scope to your project. false = Use node 's module resolution, which looks in every node_modules walking up your directory tree. |
Plugin options could be defined as follows:
// gatsby-config.js
const path = require('path');
module.exports = {
plugins: [
...
{
resolve: `gatsby-plugin-pnpm`,
options: {
projectPath: path.dirname(__dirname), // use parent directory as project root
include: [
`my-awesome-package`, // <- resolve this package name
`path/to/my/private/webpack/loaders` // <- resolve from this directory
],
strict: true
}
}
]
...
}
If you notice any issues caused by this plugin, or there seems to be some feature missing, please feel free to file an issue at https://github.com/Js-Brecht/gatsby-plugin-pnpm/issues
FAQs
Easily add pnpm support to your Gatsby project
We found that gatsby-plugin-pnpm demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.