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
Document the known differences of Electron's Node.js fork #26593
Comments
I like this idea. |
This makes sense kind of, but just to clarify a point or two.
Electron no longer has a fork of node, if you look at our DEPS file you'll see we directly depend on a tag in the
This is tricky, because I like to steer clear of a page that contains a list of known bugs. That's what the issue tracker is for, having a version controlled document for it just adds duplication. Probably better to just label certain issues with There are some things we can / should document though that aren't bugs but are intentional differences. For instance, the fact we use BoringSSL or that we disable NodeJS's ESM loader in the renderer process. And we're going to disable the TLDR: Document design decisions that diverge us from node 👍 document all bugs that we have 👎 |
I'm not familiar with the internals of Electron. What is this folder for then? https://github.com/electron/electron/tree/46972abf8b949af80ea18b81df92ceeaa26ce00d/patches/node Maybe the terminology "fork" isn't accurate, but what's the practical difference between applying patches and actually maintaining a fork in git terminology? Electron patches Node.js, which can result in bugs and which results in known intentional differences. Or not?
I absolutely agree. I was thinking more about bugs that are wontfix, because they are design decisions (like you suggested). The document could then link to a search for that tag, e.g.
This is like the fork terminology above but with the word bug. Let me take a step back and make it very clear what my original intention was: someone new to Electron reads things like
or
https://www.electronjs.org/docs/tutorial/quick-start#nodejs-api Now this person that is new to Electron starts working on their project. And eventually they stumble upon behavior they consider a bug. They run So all I'm asking for is to make it absolutely clear that these differences can occur, why they can occur and that some of these things cannot be fixed (these are bugs when you expect the same Node.js versions to do the same thing on the same machine). Does that make sense? |
I'm already confused, but could you maybe also clarify how the Node.js event loop is intermingled with the Chrome and V8 event loops? What sorcery did you do to make Node.js not aware that it is not controlling V8? |
@NotWearingPants this talk deck might help a bit |
@codebytere Thanks! The slides were too vague but I found the video, and while it was a somewhat dumbed-down explanation what I got from it is that Electron spawns a separate thread which checks if Node.js's event loop is not empty, and then uses Chromium's electron/shell/common/node_bindings.cc Line 577 in b8372fd
While it is very cool and weird, I still don't get how both Node.js and Chromium think they are in charge of V8's event loop - there can be only one. Also, this is one of the things that are important to document. |
Mentioned in #26560, here's a separate issue to track it.
Preflight Checklist
Problem Description
#26560 was about the
timeout
option of thevm
module not working in the main process. It looks like some of the Node.js tests are disabled. So I must assume there are some known differences between Electron and Node.jsAnother thing I came across a few months ago is that Electron uses BoringSSL and not OpenSSL.
Proposed Solution
When searching for "electron node.js differences" I only found this page https://www.electronjs.org/docs/development/electron-vs-nwjs
What I propose is a similar page titled "Differences between Node.js and Electron's Node.js fork". This page will
Additional Information
From the top of my head I've encounter at least these three:
I'll keep adding more as they come up:
The text was updated successfully, but these errors were encountered: