fixed webpack config bug

remembered that .env exists.
This commit is contained in:
Rekai Musuka 2019-04-01 12:50:15 -05:00
parent 86eb20d584
commit 728a701533
3 changed files with 4 additions and 5 deletions

View File

@ -9,6 +9,7 @@
"recommendations": [
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"mikestead.dotenv"
]
}
}

View File

@ -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();

View File

@ -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
}