Fix electron not starting due to "port overlap"

This commit is contained in:
GHOSCHT 2022-01-07 10:04:52 +01:00
parent 0d70b39024
commit 28115af7a7
No known key found for this signature in database
GPG key ID: A35BD466B8871994
3 changed files with 64 additions and 2966 deletions

View file

@ -39,10 +39,10 @@
}, },
"homepage": "./src", "homepage": "./src",
"scripts": { "scripts": {
"web": "webpack serve", "web": "webpack serve --port 8420",
"build": "webpack --mode=production", "build": "webpack --mode=production",
"start": "concurrently -k \"yarn web\" \"npm:electron\"", "start": "concurrently -k \"yarn web\" \"npm:electron\"",
"electron": "wait-on tcp:8080 && electron .", "electron": "wait-on tcp:8420 && electron .",
"package": "yarn build && electron-builder --publish never", "package": "yarn build && electron-builder --publish never",
"postinstall": "electron-builder install-app-deps", "postinstall": "electron-builder install-app-deps",
"lint": "cross-env NODE_ENV=development eslint . --cache --ext .js,.jsx,.ts,.tsx", "lint": "cross-env NODE_ENV=development eslint . --cache --ext .js,.jsx,.ts,.tsx",
@ -51,7 +51,6 @@
}, },
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@redux-devtools/cli": "1.0.0-9",
"@reduxjs/toolkit": "^1.7.1", "@reduxjs/toolkit": "^1.7.1",
"@types/jest": "27.0.2", "@types/jest": "27.0.2",
"@types/node": "15.14.9", "@types/node": "15.14.9",

View file

@ -7,7 +7,6 @@ const isDev = require("electron-is-dev");
const screenz = require("screenz"); const screenz = require("screenz");
const els = require("electron-localshortcut"); const els = require("electron-localshortcut");
const { default: installExtension, REDUX_DEVTOOLS, REACT_DEVELOPER_TOOLS } = require("electron-devtools-installer"); const { default: installExtension, REDUX_DEVTOOLS, REACT_DEVELOPER_TOOLS } = require("electron-devtools-installer");
const chalk = require("chalk");
const windowWidth = 900; const windowWidth = 900;
const windowHeight = 300; const windowHeight = 300;
@ -58,17 +57,12 @@ function createWindow() {
// and load the index.html of the app. // and load the index.html of the app.
win.loadURL( win.loadURL(
isDev isDev
? "http://localhost:8080" ? "http://localhost:8420"
: `file://${path.join(__dirname, "../build/index.html")}`, : `file://${path.join(__dirname, "../build/index.html")}`,
); );
if (isDev) { if (isDev) {
win.webContents.openDevTools({ mode: "detach" }); win.webContents.openDevTools({ mode: "detach" });
const reduxDevTools = require("@redux-devtools/cli").default;
reduxDevTools({ hostname: "localhost", port: 8000 }).then(() => {
console.log(chalk.blue("RemoteDev server running at http://localhost:8000/"));
});
} }
// Register shortcut to open devtools // Register shortcut to open devtools

File diff suppressed because it is too large Load diff