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

Start electron when the front-end application is available #103

Closed
TobiasTao opened this issue Jun 6, 2021 · 2 comments
Closed

Start electron when the front-end application is available #103

TobiasTao opened this issue Jun 6, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@TobiasTao
Copy link

TobiasTao commented Jun 6, 2021

Is your feature request related to a problem? Please describe.

When i use nx run-many --target=serve--projects=<frontend-app-name>,<electron-app-name> --parallel serving a nx electron application, its blank:
image
I need to restart electron to get the application back to normal
Describe the solution you'd like

add deps:

    "wait-on": "^5.3.0"
    "npm-run-all": "^4.1.5",

add scripts:

    "start": "run-p ng:start electron:start",
    "ng:start": "ng serve -o",
    "electron:start": "wait-on tcp:4200 && nx run <electron-app-name>:serve",

then run ng start, everything is fine : )

@TobiasTao TobiasTao added the enhancement New feature or request label Jun 6, 2021
@bennymeg
Copy link
Owner

bennymeg commented Jun 6, 2021

Thank you for sharing this approach.
Personally, I think invoking the serve command for each project separately it the way to go.

I will link this issue in the documentation.

bennymeg added a commit that referenced this issue Nov 22, 2021
@julianpoemp
Copy link

julianpoemp commented Dec 31, 2021

I'm using the command as workaround:

nx serve <frontend-app> & (sleep 15 && nx serve <desktop-app>)

You can add it to your scripts properties in package.json e.g. as follows:

"start:both": "nx serve <frontend-app> & (sleep 15 && nx serve <desktop-app>)"

If your Electron app starts before your frontend app build successfully, just increase the seconds after the sleepcommand.

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