【发布时间】:2022-12-02 10:05:10
【问题描述】:
I update NX and related versions. so now using node 14.15.0 instead of node 12.20.2
node version updated. so I update the aws-cdk packages. but now the following command is not working anymore. the issue is the optional chaining operator in aws-ec2.
npx env-cmd -f pipeline.json npx ts-node --project ./scripts/tsconfig.json ./apps/cloud-infrastructure/src/bin/pre-build.ts
I get the following error when I fire the above command.
node version 14.15.0. (tried in another version as well)
compiler options in ts configtsconfig.base.json
"compileOnSave": false,
"compilerOptions": {
"rootDir": ".",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"experimentalDecorators": true,
"importHelpers": true,
"target": "es2015",
"module": "esnext",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom",
"esnext.asynciterable"
],
"skipLibCheck": true,
"skipDefaultLibCheck": true
}
"files": [
"./polyfills.localize.ts"
],
"exclude": [
"node_modules",
"tmp"
]
ts config
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"types": ["node", "jest"],
"lib": ["ES6", "ES2017", "es2015", "ES2020.Promise"],
"module": "CommonJS"
},
"include": ["**/*.ts"]
}
【问题讨论】:
-
What's your TS version?
-
4.2.4 @Richard Dunn
-
What have you set as the
targetin../tsconfig.base.json? -
As I mentioned, that tsconfig isn't being used when compiling that JS. Also, that version of node doesn't appear to be the one you're using either as 14.15 should support the optional chaining operator. I don't use NX so can't help you much there, but I think it's probably not working the way you think it is.
-
I found "node" separately in the package.json and it's 12.x. so update it to 14.x and working fine
标签: javascript node.js amazon-ec2 aws-cdk