Files
youtube-music/.yarn/patches/electron-is-dev-npm-2.0.0-9d41637d91.patch
Araxeus 263a335c96 remove electron.remote dependency
now in renderer check if we are in dev mode using `'npm_package_name' in process.env`

The logic is that we always run the dev mode via npm/yarn and thus that env var will be available
2023-04-15 20:14:12 +03:00

25 lines
771 B
Diff

diff --git a/index.js b/index.js
index c8f2fd4467c11b484fe654f7f250e2ba37e8100d..c9ae1ed3d3c7683b14dfe0eee801f5a07585d2aa 100644
--- a/index.js
+++ b/index.js
@@ -5,7 +5,16 @@ if (typeof electron === 'string') {
throw new TypeError('Not running in an Electron environment!');
}
-const isEnvSet = 'ELECTRON_IS_DEV' in process.env;
-const getFromEnv = Number.parseInt(process.env.ELECTRON_IS_DEV, 10) === 1;
+const isDev = () => {
+ if ('ELECTRON_IS_DEV' in process.env) {
+ return Number.parseInt(process.env.ELECTRON_IS_DEV, 10) === 1;
+ }
-module.exports = isEnvSet ? getFromEnv : !electron.app.isPackaged;
+ if (process.type === 'browser') {
+ return !electron.app.isPackaged;
+ }
+
+ return 'npm_package_name' in process.env;
+};
+
+module.exports = isDev();