-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
window.Promise
broken: Feedback on window
being removed.
#25797
Comments
window
being removed.Promise
broken: Feedback on window
being removed.
Promise
broken: Feedback on window
being removed.window.Promise
broken: Feedback on window
being removed.
This is actually a bit backwards - the reason we removed
Deno is still Web compatible as it possibly can, but
This is not really possible, because the problem with |
As written in this issue, I don't think this is a problem with browser compatibility. It's simply a case of the user's code using A bit off topic, but Deno recently gained the ability to use Node.js global This means that Deno is no longer a runtime that completely hides Node.js. It's programmer nature to want to strive for perfection and flawlessness. |
What are they trying to detect, if not whether they are running in a browser environment vs a Node.js environment? This seems like it has everything to do with runtime detection. I think this particular point might just be a misunderstanding due to my poor phrasing or something.
I am really interested in how common this is, and what DOM-related things they try to access. I use unpkg, esm.sh, jsdelivr+esm with Deno, and haven't run into this problem (but I'm only one data point, of course). It seems a bit strange for a library to work in Node.js and the browser, to have some very critical DOM related functionality. What aspect of the DOM are they trying to interact with? And if there are e.g. 500 common packages that cover 99% of problems, then why not just tag their (immutable) CDN URLs and do a simple source patch/conversion? Are you 95%+ sure that you're not making a bad trade-off here? I.e. a trade-off that serves a (temporary) edge case at the expense of something which is fundamentally more valuable to the Deno project? I'm wondering what your confidence level is, roughly, on this. Obviously if you're 51% sure, then that's fine too, but I'm just wondering "how crazy I am", given that this seems very clearly like a bad decision to me.
This is the wrong way around imo. Deno is the web-compatible server runtime. That was almost the whole point. If are some rare edge cases, then the burden should be on those rare edge cases to add the workarounds and fixes, rather than sacrificing a very core part of Deno's philosophy. We're talking about
I agree, but again I think you've got it the wrong way around: I think removing
The team is choosing 2 here. I'm advocating for 1.
I also salute them, whichever path they take here. It's an incredible project! It basically kickstarted a new era of server-side JS. |
Yes, this is the truth. It's all a matter of how you interpret the word "web-incompatible" but I think Deno is merely a subset of the web, and never aimed to be a complete set. As for the solution, if you want to go "web-incompatible" while still implementing |
They are trying to detect whether they are in a browser vs in a SSR environment. A nice example is They added explicit code to check whether there is a Deno global, to work around this, but unfortunately many other projects did not. That meant that many frontend libraries that could run either on client or server considered deno a "client" not a "server". I was of the opinion that technical purity (ie keep |
FYI: The reason frontend code uses |
It doesn't crash in Deno v1, to be clear - it just returns
So, correct me if I'm wrong here, but the choices here were roughly:
I say "a few" pull requests because the concern here seems to be "major adopters", using non-obscure libraries/frameworks. And once the ecosystem catches on, this issue will go away, so there's no perpetual labor required here. I don't use SSR libs, but I've never had a problem with this. If patching the top 10 frameworks wouldn't mostly solve this issue, then do you have any sense for how prevalent this problem is (beyond popular frameworks that could be easily patched)? I don't understand how the decision ended up being remove If "breaking a few percent of all valid JS code in existence" is the final fallback, then I think you should be willing to get extremely creative in maneuvering out of this. This is Deno we're talking about! This ain't no run-of-the-mill, code-won't-work-in-2-years runtime. And, as an aside, I'm not averse to dying inside a little by adding I would be really surprised if the best solution to this whole predicament (in hindsight, and/or with omnipotence, or whatever) turned out to be "remove An aside on backwards-compat:
I've always had "stable interfaces" as one of my "interests" in my twitter bio. And at parties I sometimes inappropriately segue into how surprisingly-naive platforms can be in underrating backwards-compatibility. I think the TL;DR is breaking a backwards-compat contract doesn't feel very costly when you do it - it's just a few small/annoying fixes, after all! But the cost from breaking this contract comes from what it implies about the future of project, in the minds of the devs who might consider choosing it over something else. The cost comes from how it changes "what the project is". I think this "contract" is a large part of what makes the web such a force to be reckoned with, when compared to other platforms. I thought Deno was the server runtime that really saw the value in holding itself to a strong backwards-compat contract like this (and also realized how valuable it is to "hitch a ride on the juggernaut's back" by being as close to the web platform as it as is reasonable for a server-side runtime). I don't think I misinterpreted, and I don't think y'all miscommunicated. It's hard for me to understand how this trade-off calculation plays in Deno's favor in the long term, given that there are other ways to fix this.
So if I understand correctly: Deno is breaking away from the core vision (due to an issue that's solvable via other approaches) for people who are running code which patches their environment to look like a browser, but also don't want their environment to be seen as a browser by other imports. A tragedy and a comedy all in one. There's no need for this thread to continue for the sake of placating me, of course. I may become the Joker, but I'll survive. This issue can be closed if there's zero chance of any reconsideration here. If that's the case, thank you for hearing me out - I understand that this is a "judgement call" type of decision. If there is any interest in further discussion, I'm happy to keep discussing, of course. |
Deno's main goal is to be used by developers. It tries to reuse and built upon as many web APIs as possible, but it is not a browser per se. When looking at the The problem is that a significant portion of the existing JS ecosystem depends on the That said, as you articulated, this decision is a tradeoff between being "pure" to Deno's original vision vs lowering the adoption barrier for a significant portion of the JS ecosystem. That portion is to big to ignore, and we haven't heard criticism about removing the |
@josephrocca Do you want to jump on a call with me to talk through this? I really want to explain our rationale to you more, but typing out individual responses to all of your feedback is not something I have time to do right now. You can reach me at |
It's okay, but thank you. I think I understand all the core arguments. I wish there were any remotely viable way of working around this, but I'll trust that you've really thought this through, and this is basically impossible to do in any other way - even very hacky ways. I'm a bit sad, of course, but there's still a lot to love about Deno outside of the strong back-compat and web-compat aspects of the original vision, and perhaps I'm much more sensitive on these points than the majority of Deno users, having come here quite early for that explicit reason. For how 'small' a change it is, it's a surprisingly big oof for me - I guess Deno was in a different category from Node.js and Bun in my mind. But if Deno is at risk of not getting enough adoption to flourish, and there are no ways other around this issue, then trade-offs like this can make sense of course. I really appreciate your responsiveness and patience with me on this! 🫡 |
This is a good idea. |
Another option would be to have the That way |
Edit: nvm maybe not (due to |
|
I think this has more to do with older node packages checking
|
|
Please excuse the dramatic title. It sounds like the ship has sailed on this, and if it has then I'll just sigh and be a little less enthusiastic about the direction of the project, but the announcement did solicit feedback, so I'm hoping there's a chance this can be changed. Here's my feedback:
IIRC (correct me if I'm wrong) there was a clear/explicit 'promise' by @ry in the early days of Deno that web compatibility would never be broken. It may have been on Github, but the closest I could find was this:
I understand that trade-offs need to be made. But I'm not lawyering or nitpicking wording when, in referencing the above quote, I say that web compatibility is in large part what defined Deno as a project. And not just the web compatibility, but the degree of backwards compatibility that the web has. This is what sets it apart and makes it exciting. A "timeless runtime", like the web, that can run any JavaScript that could reasonably be expected to run in a server environment. Not NodeScript or DenoScript, or BunScript, but JavaScript. What an exciting vision!
This change breaks the original promise/vision in about as big a way as you possibly could (bolded for tl;dr of this whole post, not shouting). There is a lot of JavaScript in the world that will plainly no longer work at all in Deno after this change. Stuff like this:
"TextEncoder" in window
window.atob
window.navigator
Code like this is everywhere on StackOverflow and Github. Ask Claude for some web-compatible code and it's not uncommon to get code with
window
in it. It all breaks with the proposed change. Deno web compat, in broad terms, is basically downgraded to the Node.js level of "except for <arbitrary thing for no clear reason (to a newcomer) and with no fix intended> Deno is web compatible". I'm fine with "but X doesn't make sense in a server environment", but not "we removed and very core/central thing, which breaks compatibility with the web, and we did it because of a Node.js environment detection edge case".But more than that, the "vision" kinda feels dead with this change. It sounds dramatic, but this change is really big - the promise is unequivocally broken. This is not the "web" runtime anymore - I don't decide on the rules here, I just know that breaking huge amount of normal/valid JavaScript code means that a runtime can't wear that hat.
Please, (I'm down on my knees) find a (even very hacky) way to solve this which doesn't break web compatibility. E.g. enabling this change in
npm:
only, or something. Please be ambitious in thinking about other ways to solve the problem that this change is intended to solve. E.g. manually tag NPM modules. Or detect and rewrite common runtime check code (even if it only covers 95% of cases). Anything but this. Please try really hard to move the burden to the people with rare edge cases, rather than burdening the common cases, and burning down the explicitly-stated "vision" of the project for said edge case 🙏The text was updated successfully, but these errors were encountered: