plain-keyboard-29627
10/26/2021, 4:53 PMpulumi new javascript
and attempt to change const pulumi = require("@pulumi/pulumi");
into import pulumi from "@pulumi/pulumi";
, if I run/preview, I always get the following error:
error: Running program 'c:\code\xyz\infra' failed with an unhandled exception:
Error [ERR_REQUIRE_ESM]: require() of ES Module c:\code\xyz\infra\index.js from c:\code\xyz\infra\node_modules\@pulumi\pulumi\cmd\run\run.js not supported.
Instead change the require of index.js in c:\code\xyz\infra\node_modules\@pulumi\pulumi\cmd\run\run.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (c:\code\xyz\infra\node_modules\@pulumi\pulumi\cmd\run\run.js:219:31)
"type": "module"
in my package.json or by renaming index.js to index.mjs and using "main": "index.mjs"
in package.json. Same error both ways.billowy-army-68599
10/26/2021, 4:58 PMplain-keyboard-29627
10/26/2021, 5:17 PMbillowy-army-68599
11/04/2021, 7:08 PMplain-keyboard-29627
11/04/2021, 7:13 PMbillowy-army-68599
11/04/2021, 7:20 PM