-
Notifications
You must be signed in to change notification settings - Fork 15k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: add enable_remote_module build flag #19821
Conversation
500b352
to
022cbe1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exciting!
"lib/common/clipboard-utils.ts", | ||
"lib/common/crash-reporter.js", | ||
"lib/common/define-properties.ts", | ||
"lib/common/electron-binding-setup.ts", | ||
"lib/common/error-utils.ts", | ||
"lib/common/is-promise.ts", | ||
"lib/common/remote/buffer-utils.ts", | ||
"lib/common/remote/is-promise.ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we figure out how to remove these JS files from the bundle when the flag is off, too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that would be great
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should do the same for the desktop-capturer. maybe a follow up PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MarshallOfSound do you have any tips how to do this?
44b3c04
to
2e5cc9a
Compare
@@ -14,6 +14,6 @@ if (features.isDesktopCapturerEnabled()) { | |||
rendererModuleList.push({ name: 'desktopCapturer', loader: () => require('./desktop-capturer') }) | |||
} | |||
|
|||
if (enableRemoteModule) { | |||
if (features.isRemoteModuleEnabled() && enableRemoteModule) { | |||
rendererModuleList.push({ name: 'remote', loader: () => require('./remote') }) | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps it would be friendly to add a dummy module that prints an error if you try to use remote when it's disabled at build time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The module is just undefined even if you disable it at runtime currently. This was done to allow detecting whether the module is available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the future if we do remove it from core Electron, we could do this to point users to the replacement userland module.
@@ -32,7 +32,7 @@ if (features.isDesktopCapturerEnabled()) { | |||
}) | |||
} | |||
|
|||
if (process.isRemoteModuleEnabled) { | |||
if (features.isRemoteModuleEnabled() && process.isRemoteModuleEnabled) { | |||
moduleList.push({ | |||
name: 'remote', | |||
loader: () => require('@electron/internal/renderer/api/remote') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here too
@deepak1556, @codebytere can please have a look as well? |
2e5cc9a
to
426c730
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
most of this is just shuffling around code, dirs and includes, so this looks good to me as-is. I'd also like to see js files removed from the bundle when remote is disabled, but i think that could potentially be done in a follow-up.
@codebytere that’s the plan to do it in a follow up PR as it should also be done for desktopCapturer, which can also be disabled at build time |
No Release Notes |
Description of Change
Allows to remove the remote module completely at build time.
Checklist
npm test
passesRelease Notes
Notes: no-notes