Open distributev opened 5 months ago
"start": "npm-run-all -p electron:serve ng:serve"
starts a single server on port 4200 from which both the "electron" and "web" are served. The single server uses the "web" build (electron should use a different build not the "web"!)
this is another way of explaining the same issue.
"electron" should start its own server/build and "web" should start is own server/build on different ports.
I'm encountering an issue with the config.target in the angular.webpack.js file when running the
npm run start
,script which is intended for simultaneous "electron" and "web" in development (
```"start": "npm-run-all -p electron:serve ng:serve"
)To illustrate the issue, I added the following console.log statement at the end of the angular.webpack.js file:
I expected this log statement to be executed twice, once for electron-renderer and once for web, as the
npm run start
script is supposed to start both the Electron and Web apps.
"start": "npm-run-all -p electron:serve ng:serve"
However, the log statement is only executed once, and config.target is always web.
For the simple app present with this boilerplate both "electron" and "web" apps start and work fine when we do
npm run start
but for a more complex app where more electron deps are involved it will become a real problem thatconfig.target is always web. in the angular.webpack.js script.
This behavior prevents me from adding custom angular.webpack.js logic based on the config.target value, such as:
if (config.target == "electron-renderer") require("electron");
This issue seems to be related to
https://github.com/maximegris/angular-electron/issues/721
The npm run start script, which is defined as
"start": "npm-run-all -p electron:serve ng:serve"
,is intended for development and works fine for simple apps. However, for more complex apps with additional Electron dependencies, the issue becomes apparent.
I'm looking for a way to correctly set and detect the config.target value during development, so I can develop an app that works both in Electron and a web browser.
Any guidance would be appreciated.