https://serverless-stack.com/ logo
#sst
Title
# sst
m

Matt Morgan

04/24/2022, 2:01 PM
The
Function
construct has support for esm as well as the necessary shim, but even if that option is used, it still outputs a .js file instead of .mjs. https://github.com/serverless-stack/serverless-stack/blob/master/packages/core/src/runtime/handler/node.ts#L53. Is there a reason for that or is that an oversight? Is the shim even needed for .js files?
Tested it and I guess it doesn’t make any difference what the extension is.
t

thdxr

04/24/2022, 2:22 PM
Right now it outputs a package.json with type: module
That makes node treat it all as esm
I do want to switch it to being mjs for explicitness
m

Matt Morgan

04/24/2022, 2:22 PM
Got it, thanks. I was comparing it to NodejsFunction which does set the extension.