I am trying to load an ES module from a VS Code extension, see this question on stackoverflow. I believe I have run into this issue.
In another issue someone suggested to use the esm package. I tried it, see the esm branch, but I still get the following error:
[2022-04-21 15:27:47.180] [exthost] [error] Activating extension undefined_publisher.vscode-test-getport failed due to an error:
[2022-04-21 15:27:47.180] [exthost] [error] /home/hakon/test/vscode/vscode-test-getport/out/main.js:1
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/hakon/test/vscode/vscode-test-getport/node_modules/get-port/index.js not supported.
Instead change the require of index.js in null to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/home/hakon/test/vscode/vscode-test-getport/out/main.js:4:20)
at Generator.next (<anonymous>)
at Object.<anonymous> (/home/hakon/test/vscode/vscode-test-getport/out/extension.js:4:18)
at Function.<anonymous> (node:electron/js2c/asar_bundle:5:13331)
I am trying to load an ES module from a VS Code extension, see this question on stackoverflow. I believe I have run into this issue.
In another issue someone suggested to use the
esm
package. I tried it, see the esm branch, but I still get the following error:Any suggestions?
See also: https://stackoverflow.com/questions/70620025/how-do-i-import-an-es6-javascript-module-in-my-vs-code-extension-written-in-type