electron-vite-vue
electron-vite-vue copied to clipboard
[Help] how to run the built application and `npm run dev` at the same time?
On macos unable to run built app and npm run dev
at the same time.
If built app is running, then npm run dev
returns
otherwise nothing happens.
Need comment this:
if (!app.requestSingleInstanceLock()) {
app.quit()
process.exit(0)
}
)
Maybe the following code is better.
- if (!app.requestSingleInstanceLock()) {
- app.quit()
- process.exit(0)
- }
Maybe the following code is better.
- if (!app.requestSingleInstanceLock()) { - app.quit() - process.exit(0) - }
Indeed, allowing many instances if it is not required is a bad idea. So I decided to do this:
if (isDevMode()) {
app.setName(`${app.name}-dev`)
}
if (!app.requestSingleInstanceLock()) {
app.quit()
process.exit(0)
}
@caoxiemeihao thanks
The compiled application and launched through npm run dev
get one pid. Because of this, I cannot run both the built and developed applications at the same time.
@caoxiemeihao How to make the assembled application get a name not from package.json.name?
import { app } from 'electron'
app.getName()
If I understand correctly, then the OS generates a PID based on the application name. When assembled, the name is taken from package.json.name
. When I run the built app and when I run the app from npm run dev
they have the same PID. Because of this, I can't run a built app and a development app at the same time.
But if I specify a different name when building in package.json.name
, then the assembled application gets a different name. And, as a result, another PID. But it's not convenient.
I want to substitute a name during assembly that is different from what is in package.json.name
. How to do it?