]> khamidou — GitHub mirrors - electron.git/commitdiff
Support index.js module resolution at startup of Electron.
authorHaojian Wu <hokein.wu@gmail.com>
Mon, 24 Aug 2015 13:14:38 +0000 (21:14 +0800)
committerHaojian Wu <hokein.wu@gmail.com>
Mon, 24 Aug 2015 13:16:19 +0000 (21:16 +0800)
atom/browser/lib/init.coffee
docs/tutorial/quick-start.md

index 069eed8d1b53bd5a7019980fb23f6070d122cd58..1299364d2fa61a4369521351698b407ffd4fb12c 100644 (file)
@@ -92,5 +92,8 @@ app.setAppPath packagePath
 # Load the chrome extension support.
 require './chrome-extension'
 
+# Set main startup script of the app.
+mainStartupScript = packageJson.main or 'index.js'
+
 # Finally load app's main.js and transfer control to C++.
-Module._load path.join(packagePath, packageJson.main), Module, true
+Module._load path.join(packagePath, mainStartupScript), Module, true
index 197cf0d3b32b9b862b2fa7af1bd38a9a28467b12..8fc696e0bcda95c3dc1b0e1da80c0fb12ac762bb 100644 (file)
@@ -67,6 +67,9 @@ like this:
 }
 ```
 
+__Note__: If the `main` field is not present in `package.json`, Electron will
+attempt to load an `index.js`.
+
 The `main.js` should create windows and handle system events, a typical
 example being: