File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ {
2+ "presets" : [" es2015" ]
3+ }
Original file line number Diff line number Diff line change 1+ {
2+ "version" : " 0.2.0" ,
3+ "configurations" : [
4+ {
5+ "name" : " Debug Main Process" ,
6+ "type" : " node" ,
7+ "request" : " launch" ,
8+ "cwd" : " ${workspaceRoot}" ,
9+ "runtimeExecutable" : " ${workspaceRoot}/node_modules/.bin/electron" ,
10+ "program" : " ${workspaceRoot}/main.js"
11+ },
12+ {
13+ "name" : " Debug Renderer Process" ,
14+ "type" : " chrome" ,
15+ "request" : " launch" ,
16+ "runtimeExecutable" : " ${workspaceRoot}/node_modules/.bin/electron" ,
17+ "runtimeArgs" : [
18+ " http://localhost:4000" ,
19+ " --remote-debugging-port=9222"
20+ ],
21+ "sourceMaps" : true ,
22+ "webRoot" : " ${workspaceRoot}"
23+ }
24+ ]
25+ }
Original file line number Diff line number Diff line change 1+ export function sayHello ( target ) {
2+ console . log ( `hello ${ target } !` )
3+ }
Original file line number Diff line number Diff line change @@ -12,8 +12,5 @@ <h1>Hello World!</h1>
1212 and Electron < script > document . write ( process . versions . electron ) </ script > .
1313 </ body >
1414
15- < script >
16- // You can also require other files to run in this process
17- require ( './renderer.js' )
18- </ script >
15+ < script src ="/dev-dist/renderer.js "> </ script >
1916</ html >
Original file line number Diff line number Diff line change @@ -13,10 +13,10 @@ function createWindow () {
1313 mainWindow = new BrowserWindow ( { width : 800 , height : 600 } )
1414
1515 // and load the index.html of the app.
16- mainWindow . loadURL ( `file ://${ __dirname } /index.html` )
16+ mainWindow . loadURL ( 'http ://localhost:4000' )
1717
1818 // Open the DevTools.
19- mainWindow . webContents . openDevTools ( )
19+ // mainWindow.webContents.openDevTools()
2020
2121 // Emitted when the window is closed.
2222 mainWindow . on ( 'closed' , function ( ) {
Original file line number Diff line number Diff line change 44 "description" : " A minimal Electron application" ,
55 "main" : " main.js" ,
66 "scripts" : {
7- "start" : " electron ."
7+ "start" : " electron ." ,
8+ "dev" : " webpack-dev-server --no-info --quiet --port 4000 --config webpack.config.js"
89 },
910 "repository" : {
1011 "type" : " git" ,
2324 },
2425 "homepage" : " https://github.com/electron/electron-quick-start#readme" ,
2526 "devDependencies" : {
26- "electron" : " ^1.3.4"
27+ "babel-core" : " ^6.14.0" ,
28+ "babel-loader" : " ^6.2.5" ,
29+ "babel-preset-es2015" : " ^6.14.0" ,
30+ "electron" : " ^1.3.5" ,
31+ "webpack" : " ^1.13.2" ,
32+ "webpack-dev-server" : " ^1.16.1"
2733 }
2834}
Original file line number Diff line number Diff line change 11// This file is required by the index.html file and will
22// be executed in the renderer process for that window.
33// All of the Node.js APIs are available in this process.
4+
5+ import { sayHello } from './helper.js' ;
6+
7+ sayHello ( 'world' )
8+
9+ document . body . addEventListener ( 'click' , ( ) => {
10+ sayHello ( 'vscode' )
11+ } )
Original file line number Diff line number Diff line change 1+ const webpack = require ( 'webpack' )
2+
3+ module . exports = {
4+ entry : './renderer.js' ,
5+ output : {
6+ path : './dist' ,
7+ publicPath : '/dev-dist' ,
8+ filename : 'renderer.js'
9+ } ,
10+ module : {
11+ loaders : [
12+ {
13+ test : / \. j s $ / ,
14+ loader : 'babel' ,
15+ exclude : / n o d e _ m o d u l e s /
16+ }
17+ ]
18+ } ,
19+ devtool : 'eval-source-map'
20+ }
You can’t perform that action at this time.
0 commit comments