How electron creates global properties

clipboard.png

index.js



:
clipboard.png

but this makes it impossible for node to call

directly.

if export is used in node, the rendering process will not work.

how to maintain the current usage in the rendering process, and how to use global properties in the main process

or some other good global method property can be used

Feb.23,2022

add global attributes via DefinePlugin in webpack. Note! If the added attribute is an object, and a value in the object is a path, you need to JSON.stringify it, otherwise an error will be reported.

clipboard.png

clipboard.png

Menu