Describe the bug
When attempting to create a serverless package without any lambdas (and therefore code for esbuild to compile), the package step fails with an error Error: ENOENT: no such file or directory, lstat 'PATH_TO_REPO/.esbuild/.serverless'
It seems to be looking for the .serverless folder in the wrong place (within the .esbuild folder).
To Reproduce
- Create a new empty repo and install
serverless, esbuild, and serverless-esbuild.
- Use the following minimal
serverless.yml file that doesn't define any lambdas.
service: test
frameworkVersion: ^3
plugins:
- serverless-esbuild
provider:
name: aws
runtime: nodejs18.x
- Run
serverless package
- See error message
Error: ENOENT: no such file or directory, lstat 'PATH_TO_REPO/.esbuild/.serverless'
Expected behavior
If there are no lambdas to package then serverless-esbuild does no work and the package step succeeds.
Screenshots or Logs

Versions (please complete the following information):
- OS: Mac OSX Ventura 13.4.1 (22F82)
- Versions:
"esbuild": "0.19.4",
"serverless": "^3.35.2",
"serverless-esbuild": "1.48.5"
Additional context
This issue was introduced in serverless-esbuild@1.47.0 as it's the first version that shows this behaviour.
We try to install a base set of plugins across multiple repos - even those which are purely infrastructure/CloudFormation with no code. While esbuild and this plugin is not required in this repo and does not provide any benefit, we would still expect it to not cause any issues.
Describe the bug
When attempting to create a serverless package without any lambdas (and therefore code for
esbuildto compile), the package step fails with an errorError: ENOENT: no such file or directory, lstat 'PATH_TO_REPO/.esbuild/.serverless'It seems to be looking for the
.serverlessfolder in the wrong place (within the.esbuildfolder).To Reproduce
serverless,esbuild, andserverless-esbuild.serverless.ymlfile that doesn't define any lambdas.serverless packageError: ENOENT: no such file or directory, lstat 'PATH_TO_REPO/.esbuild/.serverless'Expected behavior
If there are no lambdas to package then
serverless-esbuilddoes no work and the package step succeeds.Screenshots or Logs

Versions (please complete the following information):
"esbuild": "0.19.4",
"serverless": "^3.35.2",
"serverless-esbuild": "1.48.5"
Additional context
This issue was introduced in
serverless-esbuild@1.47.0as it's the first version that shows this behaviour.We try to install a base set of plugins across multiple repos - even those which are purely infrastructure/CloudFormation with no code. While esbuild and this plugin is not required in this repo and does not provide any benefit, we would still expect it to not cause any issues.