Skip to content
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

Allow remote debugging of renderer process #136

Closed
micidrolc opened this issue Feb 1, 2022 · 4 comments
Closed

Allow remote debugging of renderer process #136

micidrolc opened this issue Feb 1, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@micidrolc
Copy link

Is your feature request related to a problem? Please describe.
I would like to debug the renderer process by attaching my IDE's debugger directly to Chrome's DevTools, but this is only possible when remote debugging is enabled.

When I tried adding the --remote-debugging-port argument to the nx run my-electron-app:serve command, the process failed with 'remoteDebuggingPort' is not found in schema error.

I tried manually adding this argument as a hardcoded value directly in normalizeArgs(file, options) function of /src/builders/execute/execute.impl.js in my local node_modules/nx-electron folder and that enabled remote debugging as expected.

Describe the solution you'd like
I believe enabling remote debugging can be achieved by:

  1. adding "remoteDebuggingPort" property to /src/builders/execute/schema.json in a similar way to "port" property (it can have no default value, so it's disabled if not explicitly requested); i.e.:
"remoteDebuggingPort": {
  "type": "number",
  "description": "Enables remote debugging of the renderer process on the defined port."
},
  1. passing this property as an argument to the underlying process in function normalizeArgs(file: string, options: ElectronExecuteBuilderOptions) of /src/builders/execute/execute.impl.ts; i.e.:
if (options.remoteDebuggingPort) {
  args.push(`--remote-debugging-port=${options.remoteDebuggingPort}`);
}

Describe alternatives you've considered

Additional context

@micidrolc micidrolc added the enhancement New feature or request label Feb 1, 2022
@bennymeg bennymeg modified the milestone: v12 Feb 19, 2022
@bennymeg
Copy link
Owner

Hi,
Thanks for the suggestion, I'll add it to v13.

@bennymeg bennymeg added this to the v13 milestone Feb 19, 2022
@bennymeg bennymeg self-assigned this Feb 19, 2022
@ratatoeskr666
Copy link
Contributor

ratatoeskr666 commented Apr 13, 2022

I made remote debugging work with the following configurations:
in the angular.json file add

"serve": {
          "builder": "nx-electron:execute",
          "options": {
            "buildTarget": "my-application:build",
            "args": [
              "--remote-debugging-port=9223"
            ],
            "inspect": true
          }
        },

You can use any other port of course.
Via Chrome Debugger you should be able to connect to the frontend process. In my IDE (Rider/Webstorm) I use the "Attach to Nodejs/Chrome" configuration

@bennymeg
Copy link
Owner

The feature had been released in the latest alpha version.

@micidrolc
Copy link
Author

Just tested this on 13.0.0-alpha.2 and can confirm that it works as expected.

Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants