diff --git a/index.js b/index.js
index 2844ffae0fdd895d42b5849dadac0a64c5fb2473..30a29e7f2eb75a58332b158cbc507f9a52b8ce32 100644
--- a/index.js
+++ b/index.js
@@ -191,7 +191,7 @@ function listPlugins(conditionTest) {
     } catch (e) {}
   }
   // Special: self dependency (if local package is also a module)
-  if (pkgJSON.main) {
+  if (pkgJSON.main && pkgJSON.main.match(/\.js/)) { // With NW.js, the main is an index.html file, which causes a bug
     const dep = pkgJSON.name
     const required = require(path.resolve('./' + pkgJSON.main))
     if (required && conditionTest(required)) {