问题
Requiring 5-10 modules in a javascript file (eg. app.js
) in a html file/render process window takes about 5 seconds to render that window, although the window is already visible. These required modules are needed for other windows as well, which seems slow. I understand that require
is also synchronous.
Therefore, should I:
- make this asynchronous, or
- require these modules globally for current and new windows, or
- call these via
ipc
frommain.js
if this is faster?, or - make this faster more practically some other way?
来源:https://stackoverflow.com/questions/44510139/node-js-electron-where-to-require-several-modules