Hello I am working on moving my code to esm, I use...
# help
b
Hello I am working on moving my code to esm, I uses datadog-cdk-constructs to setup datadog which is creating a layer on lambdas Now I am getting this error:
Copy code
Uncaught Exception { "errorType": "Error", "errorMessage": "Must use import to load ES Module: /var/task/packages/shipments/src/index.js\nrequire() of ES modules is not supported.\nrequire() of /var/task/packages/shipments/src/index.js from /opt/nodejs/node_modules/datadog-lambda-js/runtime/user-function.js is an ES module file as it is a .js file whose nearest parent package.json contains \"type\": \"module\" which defines all .js files in that package scope as ES modules.\nInstead rename index.js to end in .cjs, change the requiring code to use import(), or remove \"type\": \"module\" from /var/task/package.json.\n",
did anyone face similar issue and can help?
f
b
Actually I have implemented it due to this example @Frank