Do not add search paths in devtools
authorRyohei Ikegami <iofg2100@gmail.com>
Mon, 3 Apr 2017 13:11:29 +0000 (22:11 +0900)
committerRyohei Ikegami <iofg2100@gmail.com>
Mon, 3 Apr 2017 13:40:36 +0000 (22:40 +0900)
lib/renderer/init.js

index c6fd6a2..72f7c9e 100644 (file)
@@ -117,8 +117,11 @@ if (nodeIntegration === 'true') {
     global.__filename = __filename
     global.__dirname = __dirname
 
-    // Search for module under the app directory
-    module.paths = module.paths.concat(Module._nodeModulePaths(electron.remote.app.getAppPath()))
+    if (window.location.protocol !== 'chrome-devtools:') {
+      // Search for module under the app directory
+      // (remote.app doesn't work in devtools)
+      module.paths = module.paths.concat(Module._nodeModulePaths(electron.remote.app.getAppPath()))
+    }
   }
 
   // Redirect window.onerror to uncaughtException.