fixed webpack config bug
remembered that .env exists.
This commit is contained in:
		
							
								
								
									
										1
									
								
								.vscode/melodii.code-workspace
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.vscode/melodii.code-workspace
									
									
									
									
										vendored
									
									
								
							| @@ -9,6 +9,7 @@ | |||||||
| 		"recommendations": [ | 		"recommendations": [ | ||||||
| 			"esbenp.prettier-vscode", | 			"esbenp.prettier-vscode", | ||||||
| 			"dbaeumer.vscode-eslint", | 			"dbaeumer.vscode-eslint", | ||||||
|  | 			"mikestead.dotenv" | ||||||
| 		] | 		] | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
							
								
								
									
										2
									
								
								main.js
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								main.js
									
									
									
									
									
								
							| @@ -7,7 +7,7 @@ let win; | |||||||
| function createWindow() { | 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. |   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'); |   else win.loadFile('./build/index.html'); | ||||||
|  |  | ||||||
|   win.webContents.openDevTools(); |   win.webContents.openDevTools(); | ||||||
|   | |||||||
| @@ -2,14 +2,12 @@ require('dotenv').config(); | |||||||
| const path = require('path'); | const path = require('path'); | ||||||
| const webpack = require('webpack'); | const webpack = require('webpack'); | ||||||
|  |  | ||||||
| const absolutePath = path.resolve(__dirname, 'build'); |  | ||||||
|  |  | ||||||
| module.exports = { | module.exports = { | ||||||
|   mode: process.env.NODE_ENV, |   mode: process.env.NODE_ENV, | ||||||
|  |  | ||||||
|   entry: ['@babel/polyfill', './src/renderer.js'], |   entry: ['@babel/polyfill', './src/renderer.js'], | ||||||
|   output: { |   output: { | ||||||
|     path: absolutePath, |     path: path.resolve(__dirname, 'build'), | ||||||
|     filename: 'bundle.js' |     filename: 'bundle.js' | ||||||
|   }, |   }, | ||||||
|   module: { |   module: { | ||||||
| @@ -39,7 +37,7 @@ module.exports = { | |||||||
|   devtool: 'inline-source-map', |   devtool: 'inline-source-map', | ||||||
|   target: 'electron-renderer', |   target: 'electron-renderer', | ||||||
|   devServer: { |   devServer: { | ||||||
|     contentBase: absolutePath, |     contentBase: path.join(__dirname, 'build'), | ||||||
|     compress: true, |     compress: true, | ||||||
|     port: process.env.PORT |     port: process.env.PORT | ||||||
|   } |   } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user