acoustic-arm-1040608/19/2021, 6:29 PM
https://www.pulumi.com/docs/guides/crosswalk/aws/api-gateway/#defining-a-lambda-function-event-handler-route When I do
import * as awsx from "@pulumi/awsx";
It's saying I have to use
because of a node_module from pulumi is using require. I would like to use import instead of refactoring all my code to use require Error:
require() of /index.js from /node_modules/@pulumi/pulumi/cmd/run/run.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. Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /package.json.
little-cartoon-1056908/19/2021, 10:08 PM
even if your runtime is node14. Don't know why. So if you want to create a pure JS package for your lambdas, you either need to use commonJS, or transpile down to that. I don't know how to transpile JS->JS; the TS->JS transpilation done with Pulumi's default config has always worked for me.
acoustic-arm-1040608/20/2021, 4:25 PM