Still an issue for me whenever I upgrade SST ```Er...
# help
m
Still an issue for me whenever I upgrade SST
Copy code
Error: There was a problem transpiling the Lambda handler: file:///Users/cyber/dev/jb/platform/packages/infra/.sst/artifacts/979b4130/builder.js:2
        const esbuild = require("esbuild")
                        ^

ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and '/Users/cyber/dev/jb/platform/packages/infra/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
    at file:///Users/cyber/dev/jb/platform/packages/infra/.sst/artifacts/979b4130/builder.js:2:25
    at ModuleJob.run (internal/modules/esm/module_job.js:183:25)
    at async Loader.import (internal/modules/esm/loader.js:178:24)
    at async Object.loadESM (internal/process/esm_loader.js:68:5)
Trying to maintain this patch but it's not going great. I think I need to write package.json out to the
.sst
dir? Where do I get that path? What do we need to do to get this merged?
t
We have a lot of work to do to properly support ESM together with CJS across the board but we haven't prioritized that yet. For this issue you can probably write a
package.json
next to where that esbuild script is generated
Copy code
path.join(artifact, "package.json");
m
is where i'm at right now
working nicely for me
would be a great help if this was merged
what can I do to get this approved?
t
The latest version looks fairly minimal - do you think you can remove the package.json after it's built or no?
m
from both locations?
t
I was thinking just from the artifacts folder
m
done
it cleans up the package.json now