https://github.com/sooniter/pnpm-peer-trick
To lock the version of secondary dependencies with pnpm-dedupe-peer-dependents HACK
https://github.com/sooniter/pnpm-peer-trick
Last synced: 10 months ago
JSON representation
To lock the version of secondary dependencies with pnpm-dedupe-peer-dependents HACK
- Host: GitHub
- URL: https://github.com/sooniter/pnpm-peer-trick
- Owner: SoonIter
- Created: 2023-02-06T03:13:26.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-02T20:18:03.000Z (about 3 years ago)
- Last Synced: 2025-08-16T01:16:16.221Z (10 months ago)
- Language: JavaScript
- Homepage:
- Size: 133 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pnpm-peer-trick
Q: How to specify the version of secondary dependencies?
A: HACK the peer with pnpm to specify the secondary dependencies
```js
// before
react
dependencies
- loose-envify <---- How can I specify the version of this? peer it and auto-install-peers=true
dependencies
- js-tokens
// modified by .pnpmfile.cjs
react
peerDependencies
- loose-envify
dependencies
- js-tokens
```
```js
a > react@18.2.0 > loose-envify@1.2.0
b > react@18.2.0 > loose-envify@1.1.0
normal > react@18.2.0 > loose-envify@1.4.0
```
```js
a > react@18.2.0_loose-envify@1.2.0
b > react@18.2.0_loose-envify@1.1.0
normal > react@18.2.0_loose-envify@1.4.0
```

## what is peer?
```js
app-demo
react@18.2.0 <----------- the same
antd |
peerDependencies |
- react@18.2.0 <-----------
```
btw, I think react is the best package to test pnpm behavior
```js
react > loose-envify > js-tokens
```