Closed tkgregory closed 4 years ago
@tkgregory You're not supposed to have to rebuild, but it turns out, sometimes you do (at least if you're using TypeScript). I've narrowed this down and found a fix. If you have a moment and would like to help confirm the fix, edit your Hello CDK app's cdk.json
file so the app
line looks like this:
"app": "npx ts-node --prefer-ts-exts bin/hello-cdk.ts"
The --prefer-ts-exts
is the new bit there.
After making that change to cdk.json
, changes to the CDK app code should be reflected on the next synth, without needing to explicitly npm run build
.
I created a PR for this over on the CDK repo to add this to the TypeScript init template: https://github.com/aws/aws-cdk/pull/11470
@Jerry-AWS that's fixed the problem for me. Thanks for the quick response. 👍
I also spotted https://github.com/aws/aws-cdk/issues/7475 which maybe a duplicate?
@tkgregory Excellent catch on that duplicate!
The PR with the fix for this has been merged and will appear in the next release of the CDK. @tkgregory Thanks for raising this issue!
Looks like this missed the release of 1.74 by a couple hours; it will be in 1.75
I'm following the Typescript Your first AWS CDK app example. Half way down it says:
Having made changes to hello-cdk-stack.ts to include the S3 bucket definition, the example says to run
cdk synth
to see the S3 bucket resource definition output in CloudFormation. This only works if I runnpm run build
first, which contradicts the quote above.Please let me know if I'm doing something wrong, or amend the instructions accordingly to say that
npm run build
is required beforecdk synth
.I'm using CDK version
1.73.0 (build eb6f3a9)