0
I started to develop an application with Electron, I had never used the framework before, I always used for organization purposes to put the files in separate directories, currently this is my file structure:
IVarejo
|_ package.json
|_ assets
|_ node_modules
|_ src
| |_ main.js
|_ ui
|_ index.html
|_ login.html
|_ style.css
package json.
{
"name": "ivarejo",
"version": "1.0.0",
"description": "Um software ERP",
"main": "src/main.js",
"author": "Samuel Ives",
"dependencies": {
"electron": "^7.1.2",
"mysql": "^2.17.1",
"node-forge": "^0.9.1",
"xml-crypto": "^1.4.0"
},
"scripts": {
"start": "electron ."
},
"license": "ISC"
}
main.js
const {app, BrowserWindow} = require('electron');
let win = null;
app.on('ready', ()=>{
win = new BrowserWindow({width: 600, height: 400});
win.on('closed', ()=>{
win = null;
});
win.loadFile("../ui/login.html");
});
If I try to load the login.html file that is in the ui folder a blank screen is shown.
But if I move the file to the Ivarejo folder and change the line to the following: win.loadFile("login.html");
will simply work:
So why html files should be in the root directory?
And this https://answall.com/a/415240/3635 resolves?
– Guilherme Nascimento
@Guilhermenascimento when I pack the program to distribute, it will load the application from within the application?
– Samuel Ives
+or-, actually I "think" that it extracts in the TEMP of the operating system (current user), is a control of "Electron"
– Guilherme Nascimento