An open API service indexing awesome lists of open source software.

https://github.com/guesant/parcel-resolver-pnpm

ParcelJS plugin for a better integration with pnpm.
https://github.com/guesant/parcel-resolver-pnpm

parcel parcel-resolver pnpm

Last synced: 9 months ago
JSON representation

ParcelJS plugin for a better integration with pnpm.

Awesome Lists containing this project

README

          

# 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](https://github.com/parcel-bundler/parcel/issues/5784).

The purpose of this plugin is to improve the integration between the PNPM and ParcelJS.

## Usage

```sh
pnpm i parcel-resolver-pnpm
```

Partial `.parcelrc` file:

```
{
"resolvers": [
"parcel-resolver-pnpm",
"..."
]
}
```

----

This Proof-Of-Concept solution is based on [this comment](https://github.com/parcel-bundler/parcel/issues/5784#issuecomment-780607850).

[```src/PNPMResolver.ts```](src/PNPMResolver.ts) (based on [DefaultResolver](https://github.com/parcel-bundler/parcel/blob/17404e9a9ee6323b973a681017937a4bc6966277/packages/resolvers/default/src/DefaultResolver.js)):

```diff
+ 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