Warning about electron's removal of Node.js vm moduleSee original GitHub issue
Hi, I am using bytenode to encrypt my electron application source code and it works very well, here is the version I am currently using.
"bytenode": "^1.1.7" "electron": "^12.0.0"
When I packaged the app, electron gave me a warning that
The vm module of Node.js is deprecated in the renderer process and will be removed.
This is electron’s Release Notes Persisted.
I would like to ask if electron really removed the vm module of Node.js in the renderer process, will it be affected if I continue to use bytenode？
- Created 3 years ago
- Comments:13 (1 by maintainers)
Top GitHub Comments
Bytenode depends on
vm in order to work. So removing it may break bytenode.
I can think of a workaround if
vm is removed, but I need to try it first to make sure it works.
I can think of a workaround if vm is removed, but I need to try it first to make sure it works.
@OsamaAbbas What was your idea for the work around?
I tried to remember it but could not!
Almost a year ago I was not able to remember what the workaround that I had to restore bytenode functionality if electron goes with removing
Strangely enough, I remembered it suddenly yesterday, so I wanted to record it here before I forget it again!
Depending on how electron would remove the support for
vm in the renderer process, we have two options:
require('node:vm');. This trivial solution works for now and it does not trigger the deprecation warning. ( This is because of how they are intercepting the
requirerequest, they only look for
vmspecifically. See it here reset-search-paths.ts#L10 ).
If electron decides to take a more radical approach by blocking every possible way to reach to the
vmmodule (which seems unreasonable and hopefully unlikely), the other option will be creating a custom
vmmodule. It’s a hacky solution and I have not try this workaround (fully) yet, but it should work.
bytenode will stop having support for electron?