zawys / vscode-as-git-mergetool

VS Code extension providing diff editor layouts & more for 3-way merging
GNU Affero General Public License v3.0
43 stars 1 forks source link

yarn run test: ERR_REQUIRE_ESM errors? #14

Open eacousineau opened 2 years ago

eacousineau commented 2 years ago

Steps to reproduce

Tried in both node 14.18.1 and 16.13.0; seem to get similar results. I disabled $.scripts['lint'] in packages.json, since that seems to have its own issues (typically, prefer "node:{symbol}" over "{symbol}".

Snippet:

$ yarn run test
...
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: ${PWD}/node_modules/p-defer/index.js
require() of ES modules is not supported.
require() of ${PWD}/node_modules/p-defer/index.js from ${PWD}/out/src/settingsAssistant.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from ${PWD}/node_modules/p-defer/package.json.

This also happens when I try to launch debug mode (F5); the error is indicated in the little bottom-right notification area.

Expected behavior

It works?

I'm guessing this is a version pinning thing; I dunno anything about how yarn.lock interacts with npm stuff TBH.

Environment

Additional context

Given #10 and #11, is there something dumb I'm doing?

eacousineau commented 2 years ago

FWIW, I can compile and run the "Hello world" extension: https://code.visualstudio.com/api/get-started/your-first-extension

zawys commented 2 years ago

Given #10 and #11, is there something dumb I'm doing?

No, I can reproduce this too. I didn't work on this repository for a while. It's amazing how fast the JS ecosystem changes and builds break completely.

zawys commented 2 years ago

Maybe the quickest way to fix the issues would be to setup the repository again based on the current recommendations.