[serverless framework V4] Transpile and Build not work

I’m currently trying to use the built-in build feature in V4 to transpile and bundle src/*.ts files.

build:
  esbuild:
    # Enable bundling
    bundle: true
    # Disable function code minification
    minify: false
serverless deploy --stage dev --debug

Here’s the error message:

s:cli-error-handler: ENOENT: no such file or directory, open '/Users/kenshin/Projects/bs-lambda-sls/bs-sls3/.serverless/build/package.json' (ENOENT)
Error: ENOENT: no such file or directory, open '/Users/kenshin/Projects/bs-lambda-sls/bs-sls3/.serverless/build/package.json'

✖ ENOENT: no such file or directory, open '/Users/kenshin/Projects/bs-lambda-sls/bs-sls3/.serverless/build/package.json'
Error: ENOENT: no such file or directory, open '/Users/kenshin/Projects/bs-lambda-sls/bs-sls3/.serverless/build/package.json'

For help, try the following:
  • Run the command again with the "--debug" option
  • Run "serverless support"
  • Review the docs: https://www.serverless.com/framework/docs/

The ‘build’ directory is not being created under .serverless at all. What configuration should I make to resolve this?

Your assistance would be greatly appreciated.

1 Like