aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

typescript init templates: exclude cdk.out from tsconfig

Open rix0rrr opened this issue 7 years ago • 7 comments

Describe the bug

TypeScript files in cdk.out cause build to fail.

Example:

test/cdk.out/asset.c55a2043716c67ea5aa695ba9dae511816ddae166121bd37ef197cd34e3f0dcc/index.ts:3:28 - error TS2307: Cannot find module '../aws-custom-resource'.

rix0rrr avatar Jun 12 '19 09:06 rix0rrr

Simply adding cdk.out to the excludes in tsconfig.json doesn't seem to work, but I don't know why.

joshrp avatar Jun 26 '19 01:06 joshrp

Maybe it should be cdk_out/** ?

rix0rrr avatar Jun 26 '19 07:06 rix0rrr

I tried that along with various forms of cdk.out/**/*.ts it didn't look like it was trying to compile them, because I had my include set to specific folders too. It seemed to be just including them in it's check's and the complaining at duplicated block scope variables. (Like const AWS = require('aws-cdk') because it's outside of module scope. Fine in my app of a single script, but it shows that it's still using those files.

joshrp avatar Jun 26 '19 08:06 joshrp

@joshrp are you building with plain typescript (tsc) or with jsii?

RomainMuller avatar Jun 26 '19 12:06 RomainMuller

Plain tsc almost everything is as it was set up by cdk init. I added a ./src/func.ts file, and that conflicts with it's corresponding .ts file in ./cdk.out/asset.... I can try and grab some more debug info when I'm back on it tomorrow if you let me know what you need?

joshrp avatar Jun 26 '19 13:06 joshrp

Please ignore everything I said. I am an idiot and shall be handing in my Developers license for a 24 hour suspension.

I used the wrong file.

Using just cdk.out in the excludes array works great and I guess it should be there by default?

joshrp avatar Jun 27 '19 00:06 joshrp

I believe this has already been addressed through #2709

shivlaks avatar Sep 28 '19 21:09 shivlaks