parent
86eb20d584
commit
728a701533
|
@ -9,6 +9,7 @@
|
|||
"recommendations": [
|
||||
"esbenp.prettier-vscode",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"mikestead.dotenv"
|
||||
]
|
||||
}
|
||||
}
|
2
main.js
2
main.js
|
@ -7,7 +7,7 @@ let win;
|
|||
function createWindow() {
|
||||
win = new BrowserWindow({ width: 800, height: 600, frame: false, webPreferences: { webSecurity: false } }); //TODO: Please find a better solution for the love of god.
|
||||
|
||||
if (process.env.NODE_ENV) win.loadURL(`http://localhost:${process.env.PORT}`);
|
||||
if (process.env.NODE_ENV === "development") win.loadURL(`http://localhost:${process.env.PORT}`);
|
||||
else win.loadFile('./build/index.html');
|
||||
|
||||
win.webContents.openDevTools();
|
||||
|
|
|
@ -2,14 +2,12 @@ require('dotenv').config();
|
|||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
|
||||
const absolutePath = path.resolve(__dirname, 'build');
|
||||
|
||||
module.exports = {
|
||||
mode: process.env.NODE_ENV,
|
||||
|
||||
entry: ['@babel/polyfill', './src/renderer.js'],
|
||||
output: {
|
||||
path: absolutePath,
|
||||
path: path.resolve(__dirname, 'build'),
|
||||
filename: 'bundle.js'
|
||||
},
|
||||
module: {
|
||||
|
@ -39,7 +37,7 @@ module.exports = {
|
|||
devtool: 'inline-source-map',
|
||||
target: 'electron-renderer',
|
||||
devServer: {
|
||||
contentBase: absolutePath,
|
||||
contentBase: path.join(__dirname, 'build'),
|
||||
compress: true,
|
||||
port: process.env.PORT
|
||||
}
|
||||
|
|
Reference in New Issue