bitter-france-47214
04/12/2023, 8:45 PM"module": "es2020",
in tsconfig.json
(along with allowJs
and checkJs
set to true
), it fails with the following output in the bash terminal:
err?: Error: Command failed with exit code 255: pulumi up --yes --skip-preview --exec-kind auto.local --stack dev --non-interactive
Updating (dev)
…
pulumi:pulumi:Stack (loremipsum):
error: Running program '/Users/loremipsum/stacks/server/' failed with an unhandled exception:
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/loremipsum/stacks/server/index.js from /Users/loremipsum/node_modules/@pulumi/pulumi/cmd/run/run.js not supported.
…
code: 'ERR_REQUIRE_ESM'
I use es modules throughout the package, there is no require()
I use. But the run.js
from @pulumi/pulumi
is using require()
.
How can I fix this?tsconfig.json
{
"compilerOptions": {
"outDir": "bin",
"target": "es2016",
"module": "es2020",
"allowJs": true,
"checkJs": true,
"noEmit": true,
"sourceMap": true,
"experimentalDecorators": true,
"pretty": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"esModuleInterop": true,
"strict": true,
"moduleResolution": "node",
"forceConsistentCasingInFileNames": true
},
"files": [
"index.js"
],
"extends": "tsconfig/base.json"
}
Pulumi.yaml
name: loremipsum
runtime:
name: nodejs
options:
typescript: false
description: AWS infrastructure for a sveltekit app
package.json
{
"name": "@lorem/sveltekit-adapter",
"version": "0.0.0",
"main": "./index.js",
"type": "module",
"dependencies": {
"@pulumi/command": "^0.7.2",
"@pulumi/pulumi": "^3.62.0",
"tsconfig": "^0.0.0"
}
}
billowy-army-68599
04/13/2023, 8:05 PMbitter-france-47214
04/13/2023, 8:06 PM