Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yarn run test: ERR_REQUIRE_ESM errors? #14

Open
eacousineau opened this issue Nov 24, 2021 · 3 comments
Open

yarn run test: ERR_REQUIRE_ESM errors? #14

eacousineau opened this issue Nov 24, 2021 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@eacousineau
Copy link
Contributor

eacousineau commented Nov 24, 2021

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

  • Version of the extension: de60bc0
  • Operating system: Ubuntu 20.04
  • VS Code version: N/A
  • Other installed extensions (if applicable): N/A

Additional context

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

@eacousineau eacousineau added the bug Something isn't working label Nov 24, 2021
@eacousineau
Copy link
Contributor Author

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

@zawys
Copy link
Owner

zawys commented Nov 24, 2021

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
Copy link
Owner

zawys commented Nov 24, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants