question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prevent installation of optional peer dependencies when packaging externals

See original GitHub issue

While 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:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
olupcommented, Mar 25, 2021

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 of serverless-esbuild.

0reactions
olupcommented, Apr 13, 2021

@mattisdada what about https://github.com/floydspace/serverless-esbuild/pull/113 ? Is that solving your problem ?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found