How to solve “Cannot use import statement outside a module” error from AWS Lambda deployed with CDK
I am using the AWS CDK (v2.140.0
) to deploy a single lambda function written in ES6 javascript and with a Node v20.x
runtime. The root of the project contains a package.json
file in which I am defining "type": "module"
. I am using aws CDK and SDK packages but otherwise am not consuming any 3rd party libraries in my application code.