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.
- Host: GitHub
- URL: https://github.com/guesant/parcel-resolver-pnpm
- Owner: guesant
- License: mit
- Created: 2021-11-28T21:53:11.000Z (about 4 years ago)
- Default Branch: poc
- Last Pushed: 2021-12-09T14:04:11.000Z (about 4 years ago)
- Last Synced: 2024-02-03T10:02:38.631Z (almost 2 years ago)
- Topics: parcel, parcel-resolver, pnpm
- Language: TypeScript
- Homepage:
- Size: 51.8 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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