I can't find reference about this anywhere in their website\/docs. I need to change this to another port, currently it's stuck in 3000.
yarn create electron-app my-new-app --template=typescript
I just started out using electron-forge and ran into the same issue, and it seemed like the electron/webpack was ignoring my devServer.port
value.
After finding this doc for the electron-forge config I realized the devServer.port
is probably overwritten by electron-forge, and the values for the config were set in package.json. Here was mine:
{
"name": "my-project",
// ...
"config": {
"forge": {
"packagerConfig": {},
"makers": [
// ...
],
"plugins": [
[
"@electron-forge/plugin-webpack",
{
"mainConfig": "./webpack.main.config.js",
"renderer": {
"config": "./webpack.renderer.config.js",
"entryPoints": [
{
"html": "./src/index.html",
"js": "./src/renderer.js",
"name": "main_window"
}
]
},
// the secret sauce:
"port": 3001,
"loggerPort": 9001
}
]
]
}
}
}
Follow instructions here to setup Webpack configuration for your project (if not already done): https://www.electronforge.io/config/plugins/webpack
Then, follow the instructions here to change the devServer.port
option: https://webpack.js.org/configuration/dev-server/
As an update to this question, I was unable to replicate the top-rated answer and eventually changed the default port with a slightly different approach by implementing this answer from another post.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.