You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most of today's NodeRT users use it to call native Windows methods from Node.js or Electron. In order to do so safely in Electron's renderer process, NodeRT has to move to N-API or be otherwise made context-aware.
There are environments in which Node.js addons may need to be loaded multiple times in multiple contexts. For example, the Electron runtime runs multiple instances of Node.js in a single process. Each instance will have its own require() cache, and thus each instance will need a native addon to behave correctly when loaded via require(). This means that the addon must support multiple initializations.
Until Electron 14, NodeRT could still be loaded safely in renderer processes by using the process.allowRendererProcessReuse option. In the future, this will no longer be possible, meaning that NodeRT should not be loaded in renderer processes.
Options for Electron/NodeRT users
require() NodeRT only in the main process and use Electron's IPC to marshal calls between the main and the renderer process. This is what I, Felix, would do right now.
Move NodeRT to N-API. This is the right solution to the problem and would improve NodeRT dramatically, but I probably don't have the time to do this anytime soon.
Make NodeRT context-aware using NAN's helpers. Easier than option 2, but still work.
I'll gladly accept all pull requests helping here.
The text was updated successfully, but these errors were encountered:
Just to add that may help someone if they come across this, it is advised that native calls should not be done via Electrons Render processes instead, build a communication layer in between render and main: https://www.electronjs.org/docs/tutorial/security
Most of today's NodeRT users use it to call native Windows methods from Node.js or Electron. In order to do so safely in Electron's renderer process, NodeRT has to move to N-API or be otherwise made context-aware.
From Node.js's docs:
Until Electron 14, NodeRT could still be loaded safely in renderer processes by using the
process.allowRendererProcessReuse
option. In the future, this will no longer be possible, meaning that NodeRT should not be loaded in renderer processes.Options for Electron/NodeRT users
require()
NodeRT only in the main process and use Electron's IPC to marshal calls between the main and the renderer process. This is what I, Felix, would do right now.N-API
. This is the right solution to the problem and would improve NodeRT dramatically, but I probably don't have the time to do this anytime soon.I'll gladly accept all pull requests helping here.
The text was updated successfully, but these errors were encountered: