-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
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:
console.log(`config.target = ${config.target}`);
return config;
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 that
config.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
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.