-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Global fetch
breaks source-map
#42638
Comments
Is there an issue open for this on their repo? |
mozilla/source-map#349. It's apparently fixed in the beta releases |
Based on terser/terser#1164 (review) |
FWIW there's the Pinging @nodejs/npm in case they know how this could be mitigated. |
Ah, nice! I can add that flag to Jest's tests at least |
Is there still something for Node.js to do? |
As a project it would be nice if node could try to get in touch with the maintainers so they make a new stable release before v18 is released. But code wise I doubt there's much to be done (beyond not unflagging |
Node could also use a different name than fetch, or put it somewhere that’s not a global. |
C8 migrated away in a patch, and Jest in an alpha release. Still, that's only about half of the downloads of the broken version |
are these packages in our npm canary tests? obviously breaking changes are expected in major versions but it makes a good way to notify at least. |
Jest is (which is how I was made aware): nodejs/citgm#894. I don't think |
Heads up that this continues to be broken for source-map in node 18, which is also breaking |
I think that's being considered in #42814 (comment) - exposing |
Since |
@cspotcode incorrect; in npm, with |
@SimenB is this still a problem? |
@mcollina yes; see #42638 (comment) - jest may have worked around it but all the other source-map dependents likely haven't. |
Is there any fix we can do on the Node.js side? |
@mcollina the only fix i can think of is no longer having a global named |
please leave it a global named
one can also |
@dnalborczyk it's not a browser which is why it shouldn't have a "use a fork" doesn't work because it's a widely used transitive dependency. Certainly fixing source-map itself is an option, but that's not under node's control. |
I'm sorry, not quite sure if I'm following your argument 😄 if you are not joking, your argument could be applied to any of the supported web api in node.js. why shouldn't it be supported just because it's not a browser?
well, node.js 18 was released very recently. most production code use LTS versions. so there's still some time to correct the issue in any transitive packages, be it by a mozilla fix or a fork, until v18 reaches LTS. changing the global name now would be a BREAKING change in itself.
I was thinking about this a bit. there's another possible solution by providing the if an app wants to use |
@dnalborczyk the api is experimental so it wouldn’t require a semver-major to remove, but i understand that folks would be unlikely to agree to that. My argument is that a web API should only exist in node - at all, or as a global - if it can 100% match the semantics. fetch can’t. Obviously node folks rejected that argument, or it wouldn’t have landed in node 18, but my opinion remains. |
Note that the alpha of |
@eemeli do you think you can ship an updated version of source-map? |
I'll see what I can do. |
|
Thanks @eemeli! I think we can close this now. |
Version
v17.8.0
Platform
Darwin Simens-MacBook-Pro.local 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:45:05 PDT 2022; root:xnu-8020.101.4~15/RELEASE_X86_64 x86_64
Subsystem
No response
What steps will reproduce the bug?
npm init -y && npm install --save source-map
(this gives0.7.3
at the time of writing).source-map
has more than 160M downloads a week, although the broken v7 has a mere 28M since it's async only. See https://www.runpkg.com/[email protected]/lib/read-wasm.js#1 for where it breaks.How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
It should not break since the code is not running in a browser environment.
What do you see instead?
If
fetch
is available as a global,source-map
thinks it's in a browser setting, and breaks.Additional information
I know this isn't Node's fault, but since
source-map
seems unmaintained, I hope maybe Node as a project can reach out the the old maintainers (or Mozilla?) so this is fixed.Once v18 is stable (where
fetch
is a global by default), this'll break way more people.v8-to-istanbul
, used by both C8 and Jest (to provide code coverage reports when using native V8 coverage) is affected by this, and probably lots of other projects.The text was updated successfully, but these errors were encountered: