cookiecutter-aws-sam-typescript-layers
cookiecutter-aws-sam-typescript-layers copied to clipboard
How to handle outside src dependencies
Hello guys, thank you for this nice project. Honestly, after days researching, this was simply the best option to build lambdas with layers using SAM. This makefile trick WOW it's amazing.
I was wondering if it's possible to to use dependencies that are located outside src folder. Let me explain this scenario 👇
project
|_ src
|_ layers
|_ package.json
|_ tsconfig.json
Well, I have some utils where I'm placing inside this layer. The tsconfig.json has this path setup:
"paths": {
"/opt/nodejs/defaultResponses": ["layers/utils/src/defaultResponses"]
}
I'm importing these as follow:
import defaultResponses from '/opt/nodejs/defaultResponses'
I'm getting:
'rootDir' is expected to contain all source files
If I change tsconfig.json rootDir to
"rootDir": "."
I get this working but compiled dist folder is as follow
project
|_dist
|_ layers
|_ src
I know it's not an issue of this repo but as I'm quite new to typescript, do you guys can suggest some solutions for this?
If I move things around in makefile I'm not benefited anymore by the watch script because the compiled dist folder is not compatible with template codeuri.
I really appreciate a suggestion 😀
Thank you very much.