I am working on a serverless project. what I want to achieve or want to know if it is possible or not is that when I run sls package i want the serverless to exclude every file/folder in the root directory except for one folder.
I have tried multiple ways to do it using patterns in serverless file but nothing worked.
package: #This didn't not work
patterns:
- '!./**'
- './dist/**'
package: # This didn't work
patterns:
- '!.*/**'
- './dist/**'
Am I missing something? Because I was able to exclude particular folders if I define them explicitly. But I was unable to exclude the entire root directory using wild card characters.
package: # This works and excludes constant folder
patterns:
- '!./constants/**'
I know I can achieve it by making a script. But I want to know if it can be done via the serverless framework by simply defining the patterns.
I had the same question and this is how it worked for me:
package:
patterns:
- "!./**"
- "dist/**"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With