diff --git a/app/App.jsx b/app/App.jsx index 4aaed74..3f3eca0 100644 --- a/app/App.jsx +++ b/app/App.jsx @@ -1,4 +1,4 @@ -require('../less/main.less'); +require('./less/main.less'); import React from 'react'; import ReactDOM from 'react-dom'; diff --git a/html/index.html b/app/index.html similarity index 94% rename from html/index.html rename to app/index.html index 17c713e..0954bc7 100644 --- a/html/index.html +++ b/app/index.html @@ -16,7 +16,7 @@ const script = document.createElement('script'); const port = 8080; script.src = (process.env.HOT) ? `http://localhost:${port}/build/bundle.js` : '../build/bundle.js'; - document.write(script.outerHTML); + document.body.appendChild(script); } diff --git a/less/main.less b/app/less/main.less similarity index 100% rename from less/main.less rename to app/less/main.less diff --git a/package.json b/package.json index 78c7d71..ee7355b 100644 --- a/package.json +++ b/package.json @@ -2,30 +2,30 @@ "name": "electron-quick-start", "version": "0.1.0", "description": "Get started with Electron quickly, using webpack, react, hot module reloading, and electron-packager.", - "main": "./main.js", + "main": "./src/main.js", "scripts": { "webpack-server": "webpack-dev-server --hot --inline", "webpack": "webpack", - "start": "cross-env HOT=1 electron main.js", - "electron": "electron main.js", + "start": "cross-env HOT=1 electron src/main.js", + "electron": "electron src/main.js", "packager": "npm run webpack && electron-packager . MyApp" }, "author": "Ethereal Labs", "license": "GNU GPLv3", "dependencies": { - "react": "^0.14.2", - "react-dom": "^0.14.2" + "react": "^15.4.2", + "react-dom": "^15.4.2" }, "devDependencies": { - "babel-core": "^6.1.21", - "babel-loader": "^6.1.0", - "babel-preset-es2015": "^6.1.18", - "babel-preset-react": "^6.1.18", + "babel-core": "^6.23.1", + "babel-loader": "^6.3.2", + "babel-preset-latest": "^6.22.0", + "babel-preset-react": "^6.23.0", "copy-webpack-plugin": "^0.2.0", "cross-env": "^2.0.1", "css-loader": "^0.25.0", - "electron": "^1.3.4", - "electron-packager": "^8.0.0", + "electron": "^1.4.15", + "electron-packager": "^8.5.1", "less": "^2.7.1", "less-loader": "^2.2.3", "react-hot-loader": "^1.3.0", diff --git a/main.js b/src/main.js similarity index 96% rename from main.js rename to src/main.js index 12124c8..c20cdd3 100644 --- a/main.js +++ b/src/main.js @@ -13,7 +13,7 @@ function createWindow () { mainWindow = new BrowserWindow({width: 800, height: 600}); // and load the index.html of the app. - mainWindow.loadURL(`file://${__dirname}/html/index.html`); + mainWindow.loadURL(`file://${__dirname}/../app/index.html`); // Open the DevTools. mainWindow.webContents.openDevTools(); @@ -24,7 +24,7 @@ function createWindow () { // in an array if your app supports multi windows, this is the time // when you should delete the corresponding element. mainWindow = null; - }) + }); } // This method will be called when Electron has finished diff --git a/webpack.config.js b/webpack.config.js index 90d48e9..a1d8701 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,7 +2,7 @@ var webpack = require('webpack'); var CopyWebpackPlugin = require('copy-webpack-plugin'); var path = require('path'); var dir_build = path.resolve(__dirname, 'build'); -var dir_html = path.resolve(__dirname, 'html'); +var dir_html = path.resolve(__dirname, 'app'); var dir_js = path.resolve(__dirname, 'app'); module.exports = { @@ -28,7 +28,7 @@ module.exports = { loader: 'babel-loader', exclude: /node_modules/, query: { - presets: ['react', 'es2015'] + presets: ['react', 'latest'] } }, { test: /\.css$/, loader: 'style-loader!css-loader' },