Merge pull request #2571 from atom/index-entry-startup

Support index.js module resolution at startup of Electron.
This commit is contained in:
Cheng Zhao 2015-08-26 12:35:24 +08:00
commit c441dd1436
2 changed files with 7 additions and 1 deletions

View 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

View 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: