Prevent installation of optional peer dependencies when packaging externals
See original GitHub issueWhile investigating #103 I saw that pg-native
gets always bundled with pg
which might not be needed by the code (if it doesn’t actually require native pg from pg). This is listed as peerDependencies
, but set optional with :
"peerDependenciesMeta": {
"pg-native": {
"optional": true
}
}
We might not want to auto bundle optional peer deps in the externals @floydspace ?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:13 (10 by maintainers)
Top Results From Across the Web
How do I handle optional peer dependencies when publishing ...
Since Typescript 3.8 you can use the following syntax: import type { ExternalFoo } from "foo";. So if you're just using that library...
Read more >Understanding Peer Dependencies in JavaScript
Peer dependencies really come into play when you're developing code that will be used by others, such as plugins and packages. If you're...
Read more >Peer Dependencies | Node.js
UPDATE: npm versions 1, 2, and 7 will automatically install peerDependencies if they are not explicitly depended upon higher in the dependency ...
Read more >package.json - npm Docs
The optional files field is an array of file patterns that describes the entries to be included when your package is installed as...
Read more >Difference between dependencies, devDependencies and ...
peerDependencies are not automatically installed. You need to manually modify your package.json file in order to add a Peer Dependency.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am not sure yet, but as of now I think you are right, we should probably just implement plugins (I wanted to make a PR this week but have been delayed) and leave this as a workaround. This is a true edge-case, I think there is a questionable design from the
pg
library. But I can only agree with you when you note that it’s probably outside of the scope ofserverless-esbuild
.@mattisdada what about https://github.com/floydspace/serverless-esbuild/pull/113 ? Is that solving your problem ?