-
Notifications
You must be signed in to change notification settings - Fork 940
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
debug causes npm to always issue an experimental ESM warning in node 23 #975
Comments
The warning can also be temporarily disabled using |
supports-color@9.0.0, released in Apr 2021, was the first version to use pure ESM. This issue affects any project where supports-color >= For instance, on Ubuntu git clone https://github.com/cypress-io/github-action
cd github-action
npm ci
node src/ping-cli.js https://example.cypress.io not only shows the node src/ping-cli.js https://example.cypress.io which is not using
https://github.com/cypress-io/github-action is configured with supports-color@9.3.1, i.e. a pure ESM version. |
@MikeMcC399 however, it'd only trigger on projects that |
Under Node.js
|
This is probably fine; I don't think that was around when I implemented the optional dependency stuff. PR welcome and I'll cut a patch release ASAP (especially if it's within the next 48 hours, otherwise might be after Nov 16th at some point. Some last minute traveling happening for urgent reasons. Ping me here if it falls through the cracks). |
@Qix-, first of all, thanks for your attention to this issue. I would really appreciate it if you could take a look at npm/cli#7857 (comment), since it would directly implicate this project and, naturally, npm/cli (in a good way).
|
@stefee kindly submitted a PR, but the regressions stated here are a bit bothersome. The only other "correct" alternative is to switch to ESM-only and use There's a less-nice alternative. Start without any extended color support, fire off an async |
Another option would be to introduce a build system to ship |
In case people are not following this linked issue: There's a possibility the warning will be hidden in Node 23, too: nodejs/node#55217 (comment) |
I'm not super keen on adding a build system, personally. Debug shouldn't need one; it's a trivial package. If every package ends up needing a build system then I'm not sure what that says about the Node.js ecosystem. Perhaps an unpopular opinion. |
Totally agree, I am of the personal opinion that we need to get back to simple packages that are aligned across the ecosystem, just wanted to throw out the option. Since it looks like this warning will be removed from Node.js it might be worth it to just wait this one out, as it might resolve itself. That said, since all Node.js LTS versions will soon have support for importing ESM from CommonJS it might be worth it to then consider adopting ESM as well. But this is likely an entirely separate discussion. |
It’ll be possibly years before all LTS versions support that. |
Looks like at least 22.x is getting a backport (see nodejs/node#52697), and I was under the impression that the same would be done for 20.x and even 18.x but I could be mistaken. 18.x will be end-of-life the first half of next year as well. |
I guess another way of handling this is to simply vendor in Feels very "putting a stick in your own bicycle spokes meme". |
So at the very least 20.x will have a backport (nodejs/node#52697 (comment)). Might be worth a semver major once 18.x reaches EOL. |
Unfortunately the stick was making it ESM-only :-/ |
FYI for v22.x the warning would be suppressed when the require() is coming from node_modules. For v23 we are considering the same but complications apply due to LTS policy nodejs/node#55217 (comment) |
Specifically,
debug/src/node.js
Line 32 in bc60914
I'm not sure the best solution here. One is to use optional peer deps to force
supports-color
to be< 9
; another is to do monkeypatching shenanigans around that require to suppress the experimental warning; I'm sure there's more.The text was updated successfully, but these errors were encountered: