mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-17 05:02:06 +00:00
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
This commit is contained in:
24
.yarn/patches/electron-is-dev-npm-2.0.0-9d41637d91.patch
Normal file
24
.yarn/patches/electron-is-dev-npm-2.0.0-9d41637d91.patch
Normal file
@ -0,0 +1,24 @@
|
||||
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();
|
||||
Reference in New Issue
Block a user