ParcelJS considers all dependencies that are symbolic links as "source dependencies" and then takes special treatment. However, for the PNPM package manager each installed package is a symbolic link to the packages stored in the store. Learn more in this issue.
The purpose of this plugin is to improve the integration between the PNPM and ParcelJS.
pnpm i parcel-resolver-pnpm
Partial .parcelrc
file:
{
"resolvers": [
"parcel-resolver-pnpm",
"..."
]
}
This Proof-Of-Concept solution is based on this comment.
src/PNPMResolver.ts
(based on DefaultResolver):
+ resolver.processPackage = async function (pkg: any, file: string, dir: string) {
+ await NodeResolver.prototype.processPackage.call(this, pkg, file, dir)
+ if (pkg.source) {
+ const realpath = await this.fs.realpath(file)
+ if (realpath.includes("node_modules/.pnpm")) {
+ delete pkg.source
+ }
+ }
+ }
MIT