-
Notifications
You must be signed in to change notification settings - Fork 52
Make SST work with typescript monorepo (imports from workspace packages) #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for sst-docs canceled.
|
✅ Deploy Preview for sst-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
|
@fwang I think this is ready for merging if you're happy with it. |
|
@BryanCrotazGivEnergy I think this should be better handled by a different tool like https://turbo.build/ for managing build dependency instead of bake it into SST. We have our build steps for internal dependencies cached & this would defeat the purpose as they are rebuilt every time. |
|
This is not about managing build dependency between libraries. This is the sst build of the stack files.
We use NX to manage our builds and that only builds packages that have been modified. All good. But that build includes sat building the stack. That’s where the problem is.
We can’t control the external dependencies when the stack is built, we can only control them when the handler is built.
This PR fixes an issue that’s existed since version 0.1 (see linked issue).
Sent from Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Hoang Nguyen ***@***.***>
Sent: Friday, April 11, 2025 12:21:27 AM
To: sst/v2 ***@***.***>
Cc: Bryan Crotaz ***@***.***>; Mention ***@***.***>
Subject: Re: [sst/v2] Make SST work with typescript monorepo (imports from workspace packages) (PR #68)
[WARNING: This email originated from outside of the organisation. Do not click links or open attachments unless you recognise the sender and know the content is safe]
@BryanCrotazGivEnergy<https://github.com/BryanCrotazGivEnergy> I think this should be better handled by a different tool like https://turbo.build/ for managing build dependency instead of bake it into SST.
We have our build steps for internal dependencies cached & this would defeat the purpose as they are rebuilt every time.
—
Reply to this email directly, view it on GitHub<#68 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BLGZEQY6BU7TPGMAXTVZNNL2Y34HPAVCNFSM6AAAAAB2YTE6F2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOOJVGM3TSMRUGI>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
[https://avatars.githubusercontent.com/u/773456?s=20&v=4]hoangnd25 left a comment (sst/v2#68)<#68 (comment)>
@BryanCrotazGivEnergy<https://github.com/BryanCrotazGivEnergy> I think this should be better handled by a different tool like https://turbo.build/ for managing build dependency instead of bake it into SST.
We have our build steps for internal dependencies cached & this would defeat the purpose as they are rebuilt every time.
—
Reply to this email directly, view it on GitHub<#68 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BLGZEQY6BU7TPGMAXTVZNNL2Y34HPAVCNFSM6AAAAAB2YTE6F2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOOJVGM3TSMRUGI>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
|
@BryanCrotazGivEnergy please forgive my ignorance & disregard my comment if I'm wrong here, For example: service-a-iac/package.json service-a-lambda-functions/package.json |
|
Try that and you will find it doesn’t work if the dependency is written in typescript.
Sent from Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Hoang Nguyen ***@***.***>
Sent: Friday, April 11, 2025 12:59:39 AM
To: sst/v2 ***@***.***>
Cc: Bryan Crotaz ***@***.***>; Mention ***@***.***>
Subject: Re: [sst/v2] Make SST work with typescript monorepo (imports from workspace packages) (PR #68)
[WARNING: This email originated from outside of the organisation. Do not click links or open attachments unless you recognise the sender and know the content is safe]
@BryanCrotazGivEnergy<https://github.com/BryanCrotazGivEnergy> please forgive my ignorance & disregard my comment if I'm wrong here,
but could your problem be solved by separating out stack & handler/lambda dependency so they can be managed separately?
For example:
service-a-iac/package.json
{
"internal-iac-package": "workspace:*",
"sst": "*",
"aws-cdk-lib": "*",
"service-a-lambda-functions": "workspace:*" // to ensure lambda code to be built before iac code
}
service-a-lambda-functions/package.json
{
"internal-lambda-package": "workspace:*",
"sst": "*"
}
—
Reply to this email directly, view it on GitHub<#68 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BLGZEQ3LYCQNPM2DWHZFVAL2Y4AWXAVCNFSM6AAAAAB2YTE6F2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOOJVGQ2TENRRHA>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
[https://avatars.githubusercontent.com/u/773456?s=20&v=4]hoangnd25 left a comment (sst/v2#68)<#68 (comment)>
@BryanCrotazGivEnergy<https://github.com/BryanCrotazGivEnergy> please forgive my ignorance & disregard my comment if I'm wrong here,
but could your problem be solved by separating out stack & handler/lambda dependency so they can be managed separately?
For example:
service-a-iac/package.json
{
"internal-iac-package": "workspace:*",
"sst": "*",
"aws-cdk-lib": "*",
"service-a-lambda-functions": "workspace:*" // to ensure lambda code to be built before iac code
}
service-a-lambda-functions/package.json
{
"internal-lambda-package": "workspace:*",
"sst": "*"
}
—
Reply to this email directly, view it on GitHub<#68 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BLGZEQ3LYCQNPM2DWHZFVAL2Y4AWXAVCNFSM6AAAAAB2YTE6F2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOOJVGQ2TENRRHA>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
I was having the same issue as #4328.
When building the stack, SST marks all dependencies as external. However monorepo packages haven't been built at this stage, so the TS hasn't been transpiled to JS. Workspace dependencies need to be internal, not external.
This PR filters out packages that are versioned as
"workspace:...."when marking dependencies as external when building the stack.