Why do we need "build": "tsc" and "watch": "tsc -w" #19516
-
I was wondering why there are these scripts to compile typescript files. As far as I can see, no action in a cdk app needs the .js or .d.ts files. const { defaults } = require('jest-config');
module.exports = {
...
modulePathIgnorePatterns: ['.*__mocks__.*\\.(js|jsx)$'],
moduleFileExtensions: ['ts', 'tsx', ...defaults.moduleFileExtensions],
...
}; But the cdkworkshop still says that we need to compile the ts files https://cdkworkshop.com/20-typescript/20-create-project/200-watch.html The only case I can imagine, is when publishing a construct as a npm package, while a npm package should contain the compiled files. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I think the |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
I think the
"build"
and"watch"
scripts generated by default in thepackage.json
files by thecdk init
command are historic artifacts. The switch to TS-Node was actually an external contribution, and I think we missed removing them (frompackage.json
, and also from the CDK Workshop).