Closed trivikr closed 5 months ago
Experimental commits can be viewed in https://github.com/trivikr/aws-sdk-js-notes-app/commits/use-esm
Not going ahead right now as:
output.libraryTarget: 'module'
https://github.com/webpack/webpack/issues/2933You probably know this, but just to clarify, ts-node's ESM support is experimental out of necessity, because node's ESM loader hooks are experimental. So there's no way we can guarantee a stable feature built on unstable node APIs.
Even though node's ESM feature is "stable," the reality is that it's still limited compared to CommonJS, due to the unstable nature of ESM loader hooks.
No longer needed, as we now bundle through aws_cdk.aws_lambda_nodejs https://github.com/aws-samples/aws-sdk-js-notes-app/pull/122
Is your feature request related to a problem? Please describe.
Not a problem, but it would be good to show Node.js using ESM as:
ESM comes with many benefits, like language-level syntax, browser support, defaults to strict mode, async loading, top-level await, improved static analysis & tree-shaking, and more.
Describe the solution you'd like
Use ESM modules in the todo app backend by setting
"type": "module"
in package.json. Docs: https://nodejs.org/api/esm.html#esm_enablingDescribe alternatives you've considered
Sticking with using commonjs for the backend.