My Setup
I have a yarn workspaces monorepo with several packages. Each package corresponds to a lambda function that will ultimately be deployed to aws.
For locally mocking I have a local-server which I am running using ts-node triggered via nodemon. The idea being that I can modify any of my packages and see the results immediately on my local mock server without having to rebuild any of my packages.
My Code
My full setup is here but I have created a much simpler striped down project here to demonstrate my problem.
You can checkout the stripped down project and run
yarn install
yarn start:with:rel #(uses relative imports and works fine)
yarn start:with:abs #(uses absolute imports and does not work)
Illustration
My Problem
I can not get my absolute path imports to work when using ts-node to run the handlers in each of my monorepo packages. I am sure there if some nifty trick I can do with tsconfig-paths or module-alias but I can get it working.
I need a way to tell ts-node to run the code in each package using the absolute path configuration of the package.
Notes
It does seem that module-alias allows you to import aliases from a particular package.json file as shown here. If anyone has any examples of the advanced usage that would be amazing. I don't understand how to configure this.
Thanks :)