From 1bf06bd5b44c0e88f585650e3ce828fb9b63bf1b Mon Sep 17 00:00:00 2001 From: "A. Sayef Reyadh" Date: Wed, 24 Aug 2022 22:37:58 +0600 Subject: [PATCH] Docs: add info for serverless-esbuild users (#3235) --- docs/install.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/install.md b/docs/install.md index 40f505b1..917947e6 100644 --- a/docs/install.md +++ b/docs/install.md @@ -255,6 +255,26 @@ SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install --arch=x64 --platform=linux --libc=gli To get the best performance select the largest memory available. A 1536 MB function provides ~12x more CPU time than a 128 MB function. +### serverless-esbuild + +To deploy AWS Lambda using serverless framework, esbuild and serverless-esbuild on machines other than Linux x64 (glibc), first ensure sharp is excluded from bundling via the +[external option](https://www.serverless.com/plugins/serverless-esbuild#options) +configuration. +Make changes inside `serverless.yml` under `esbuild` with the following. +``` +custom: + # Keep existing changes + esbuild: + # Keep existing changes + external: + - sharp + packagerOptions: + scripts: + - npm install --arch=x64 --platform=linux sharp +``` +After successful deployment, comment out the scripts `- npm install --arch=x64 --platform=linux sharp` if you want to use `serverless-offline` + + ## Bundlers ### webpack