-
-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Third level peerDependency is not excluded / canvas.node: invalid ELF header #312
Comments
Ah I think I know the issue but won't have much time this week serverless-esbuild/src/helper.ts Line 83 in dc3c684
This needs the |
Thanks for pointing me in the right direction 👍 I will create a PR if I find some spare time. |
I'd have to test this but I believe this line here: serverless-esbuild/src/helper.ts Line 92 in fbf213d
|
I can't think of a good way to implement the But as I now understand, our problem is caused by the plugin-internal installExtraArgs:
- '--legacy-peer-deps' TL;DR: Our problem can be solved with a different solution, but the bug is still valid in my opinion. |
Oh I see because you are not using package individually. |
I've opened a PR addressing this issue #481 |
Describe the bug
We have a lambda with dependency jsdom, which has peerDependency canvas. Until recently, canvas was not installed by npm and not bundled by esbuild. If canvas is present, an error
canvas.node: invalid ELF header
is thrown at runtime.Since the latest update, our devDependency
pdf-visual-diff
requirescanvas
. This leads tocanvas
beeing included in the bundle and runtime errors.We were hoping to prevent
canvas
from beeing included by adding it toexclude
in the serverless.yml, but that does not work.To Reproduce
npm i
npm test
Dependencies in package.json:
Config in serverless.yml:
Run
npx sls package
and unzip the bundle =>node_modules/canvas
exists :(Expected behavior
node_modules/canvas
is not included in the bundle.Versions (please complete the following information):
Workaround
Deleting the canvas directory works, but all dependencies of canvas stay included in the bundle:
The text was updated successfully, but these errors were encountered: