parcel-resolver-pnpm
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i parcel-resolver-pnpm

Weekly Downloads

1

Version

0.0.1

License

MIT

Unpacked Size

9.99 kB

Total Files

9

Last publish

Collaborators

  • antunesrodrigues