Error [ERR_REQUIRE_ESM]: require() of ES Module os-locale
Closed this issue · 0 comments
rgrunber commented
So I ran into this trying to run tests :
https://github.com/redhat-developer/vscode-java/actions/runs/4514928844/jobs/7955465271?pr=2295
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/runner/work/vscode-java/vscode-java/node_modules/@redhat-developer/vscode-redhat-telemetry/node_modules/os-locale/index.js from /home/runner/work/vscode-java/vscode-java/node_modules/@redhat-developer/vscode-redhat-telemetry/lib/node/platform.js not supported.
Instead change the require of index.js in /home/runner/work/vscode-java/vscode-java/node_modules/@redhat-developer/vscode-redhat-telemetry/lib/node/platform.js to a dynamic import() which is available in all CommonJS modules.
According to microsoft/vscode#130367 , this isn't supported.
In vscode-redhat-telemetry 0.5.4, the requirement was on os-locale 5.0.0, but for 0.6.0, it's now os-locale 6.0.2 . os-locale moved to ESM in 6.0.0.
Most online resources seem to imply the only solution is to downgrade to the last version that supported CommonJS. https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-import-esm-in-electron
CC @fbricon