Bug: sam build
Ignores Files in dist/ Directory When Specified in .gitignore
#7402
Labels
area/build
sam build command
area/node-npm
blocked/more-info-needed
More info is needed from the requester. If no response in 14 days, it will become stale.
Title:
sam build
Ignores Files indist/
Directory When Specified in.gitignore
Description
Issue Summary
When specifying the
dist/
directory in the.gitignore
file, thesam build
process also ignores the files in this directory. This behaviour causes issues when the build output is expected to be in thedist/
directory, as the necessary files are not included in the build.Steps to Reproduce
.gitignore
file with the following content:dist/
dist/
directory.sam build
command.Expected Behaviour
The sam build process should include the files in the
dist/
directory, even if it is specified in the.gitignore
file, as the.gitignore
file should only affect Git operations.Actual Behaviour
The sam build process ignores the files in the
dist/
directory, causing the dist folder not to be copied to.aws-sam/build/function_name/
.Workaround
Removing the
dist/
entry from the.gitignore
file allows the sam build process to include the necessary files, but this is not an ideal solution as it causes thedist/
directory to be tracked by Git.Environment
SAM CLI Version: 1.123.0
Node.js Version: v20.9.0
OS: 14.3 (23D56)
Additional Context
My build process is to run
tsc && sam build && sam deploy
, the lambda handler is set todist/path_to_handler
.The text was updated successfully, but these errors were encountered: