I use serverless-layers plugin in Serverless Framework so I'd like to exclude node_modules directory from esbuild.
According to the official document, I can set "*" to the exclude option of serverless-esbuild to exclude the full node_modules directory.
An array of dependencies to exclude from the Lambda. This is passed to the esbuild external option. Set to * to disable packaging node_modules ['aws-sdk']
However, it doesn't seem to work if I set it in serverless.ts
.
Here was my trials:
exclude: ['*']
exclude: '*'
exclude: ['./node_modules/*']
On the other hand, specifying each library works well like this:
exclude: ['aws-sdk', 'mysql2', '@middy']
Is there something I missed?
Thanks.