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
Is your feature request related to a problem? Please describe.
My application uses multiple renderer processes. Some require nodeIntegration, other's don't. I'd like to disable nodeIntegration from the processes that don't require it. However it appears, according to my current understanding, that that can't be done with this plugin. It seems setting vue.config.js's pluginOptions.electronBuilder.nodeIntegration sets it globally for all renderer processes. Is that correct?
Describe the solution you'd like
Each renderer process should be able to specify whether or not nodeIntegration is enabled for that specific renderer process.
The text was updated successfully, but these errors were encountered:
Enabling nodeIntegration per-process at runtime is pretty simple, just replace process.env.ELECTRON_NODE_INTEGRATION with the value you want for that process. Where it gets tricky is with the webpack config.
Renderer builds share the same webpack config, which means they all have the same target. Therefore, you can't use the electron-renderer target, which breaks node's builtin modules (and maybe some other things). What you can do is enable nodeIntegration in the plugin settings, then override the webpack target with a custom chain:
This will enable native node modules to work like normal, but also allow processes without nodeIntegration to work. However, node's bultin modules (like fs) won't work by default. To get around this, you have to use __non_webpack_require__('package') to import a node builtin. I tested this out and it seems to work fine, although it isn't exactly pretty. Unfortunately, I can't think of a better way. You might be able to set up some fancy webpack config to handle it but I'm not sure how you would do that.
Let me know if this works or if you have any more questions.
Is your feature request related to a problem? Please describe.
My application uses multiple renderer processes. Some require nodeIntegration, other's don't. I'd like to disable nodeIntegration from the processes that don't require it. However it appears, according to my current understanding, that that can't be done with this plugin. It seems setting vue.config.js's pluginOptions.electronBuilder.nodeIntegration sets it globally for all renderer processes. Is that correct?
Describe the solution you'd like
Each renderer process should be able to specify whether or not nodeIntegration is enabled for that specific renderer process.
The text was updated successfully, but these errors were encountered: