I declare 3 packages in my externals list, but only 2 of them get included in the zip package of my lambda function.
The packages in question are:
canvas
chart.js
chartjs-node-canvas
I believe the issue is that chartjs-node-canvas has canvas as a dependency, but chart.js as a peer dependency. When I run serverless package I get a warning
WARNING: Could not check for peer dependencies of chartjs-node-canvas. Set nodeModulesRelativeDir if node_modules is in different directory.
I believe if nodeModulesRelativeDir is exposed as an additional webpack config we can modify via serverless-bundle, I'd be able to configure it to correctly pull through the peer dependency chart.js as well.
I believe this was caused because my services are part of a monorepo. I've now exposed this setting via serverless-bundle config and it's working! I'll send a PR soon.
I declare 3 packages in my externals list, but only 2 of them get included in the zip package of my lambda function.
The packages in question are:
I believe the issue is that
chartjs-node-canvas
hascanvas
as a dependency, butchart.js
as a peer dependency. When I runserverless package
I get a warningI believe if
nodeModulesRelativeDir
is exposed as an additional webpack config we can modify via serverless-bundle, I'd be able to configure it to correctly pull through the peer dependencychart.js
as well.