我在无服务器框架上有项目。我需要调整图像大小。我编写了lambda函数并安装了模块 var renderers = $.extend($.pivotUtilities.renderers, $.pivotUtilities.export_renderers, $.pivotUtilities.gchart_renderers, $.pivotUtilities.derivers);
var tpl = $.pivotUtilities.aggregatorTemplates;
$("#output").pivotUI(data.data, {
renderers: renderers,
rows: ["fieldOne", "fieldTwo", "fieldThree", "Duration"],
cols: [],
//hiddenAttributes: ["Total"],
aggregators: {
"Total Time": function () {
return tpl.sum()(["Duration"]);
}
},
aggregatorName: "Total Time"
});
。我也使用sharp
。在webpack中,我添加serverless-webpack
并在下一步中添加serverless.yml:
externals: ['sharp']
我成功部署了它,但是运行lambda时我得到了
错误:找不到模块“尖锐” 也许我做错了。如果需要更多信息,我可以写出来。
答案 0 :(得分:1)
您可以使用forceInclude
# serverless.yml
custom:
webpack:
includeModules:
forceInclude:
- sharp