-
npm install
index.html, -
, -. , Webpack, html, cs js, index.html.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>QuickMap</title>
<link href='public/css/boostrap.min.css' rel='stylesheet'>
<link href='public/css/layout.css' rel='stylesheet'>
</head>
<body>
<div id='root' />
<script src='public/js/appBundle.js' type='text/javascript'></script>
<script src='public/js/bootstrap.min.js' type='text/javascript'></script>
<script src='public/js/jquery-3.1.1.min.js' type='text/javascript'></script>
</body>
</html>
, index.html , , -i.e html, css, js . , , jQuery, .
- Electron, Webpack
Express Webpack, index.html.
, Webpack Express Electron. , index.html , , -.
Webpack, index.html.
index.html, webpack, -.
, index.html, Express
, . , , - ( Webpack) .
, Electron, , , index.html, .
main.js
const {app, BrowserWindow} = require('electron')
const path = require('path')
const url = require('url')
let win
function createWindow () {
win = new BrowserWindow({width: 800, height: 600})
win.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
slashes: true
}))
win.webContents.openDevTools()
win.on('closed', () => {
win = null
})
}
app.on('ready', createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (win === null) {
createWindow()
}
})
index.html, , .
mainWindow.loadURL(`file://${__dirname}/index.html`)
script .json
"scripts": {
"start": "ENV=development electron .",
},
,
npm start
main.js .