Utilizing Amazon Lambda AWS along with Serverless and the Serverless Plugin TypeScript to develop my TypeScript files has been quite a challenge. I have implemented shared code in my project, organized within folders such as:
/shared: shared1.ts, shared2.ts
/microservice1: microservice1.ts, serverless.yml
/microservice2: microservice2.ts: serverless.yml
From my research, it seems impossible to pass a YAML file via the command line for Serverless deploy. As a result, the current working directory must be located inside either "/microservice1" or "/microservice2". This restriction leads to an error during the build process stating: 'File '...shared1.ts' is not under 'rootDir' '...microservice1'. 'rootDir' is expected to contain all source files.' Unfortunately, setting rootDir to "../" in tsconfig.json gets overwritten by the default value './'. It appears that the only workaround is using symlinks, which in my opinion, feels somewhat hacky.
Is there a way to build these shared files without relying on symlinks?