0.0.1 • Published 2 years ago

parcel-resolver-pnpm v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

parcel-resolver-pnpm

About

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.

Usage

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
+     }
+   }
+ }

References:

License

MIT