mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-10 10:11:46 +00:00
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
25 lines
771 B
Diff
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();
|