tommedema / serverless-mono-example

Example repo on how to use yarn workspaces together with the serverless framework.
124 stars 10 forks source link

Do you need to rebuild dependency packages on deploy? #5

Closed shawnmclean closed 5 years ago

shawnmclean commented 5 years ago

Lets say you update something in a dependency package (random), but in your sls project you run the deploy/build, it will not pull in that change because main is pointing to dist/index.js.

Is there a way to point directly to the ts file so no build is required?

justinwaite commented 5 years ago

In my experience, building and deploying from the sls project will rebuild random, as long as it is a dependency. That's part of the typescript 3 project references I think.

Do you have your tsconfig file for the sls project referencing random properly?

tommedema commented 5 years ago

When you run serverless deploy this starter will automatically rebuild due to this line:

https://github.com/tommedema/serverless-mono-example/blob/master/packages/sls-random/serverless.yml#L34

shawnmclean commented 5 years ago

Thanks both. I tried the ts 3 references feature, I checked out this project along with a few others and it didn't seem to build the dependencies.

When using sls, it runs that custom script that explicitly runs the yarn build. That works but not the one that uses tsc.