Description
Pre-flight checklist
- I have read the contribution documentation for this project.
- I agree to follow the code of conduct that this project uses.
- I have searched the issue tracker for a bug that matches the one I want to file, without success.
Electron Forge version
7.1
Electron version
27.1
Operating system
win10
Last known working Electron Forge version
No response
Expected behavior
Open the exe and you can access the project resources of vue normally.
Actual behavior
Hello, according to the electron-vite template file, asar is turned on, and all static pages are put into the asar file. However, after the electron application is packaged into exe through electron-forge, the vue-related resource files and homepage index.html cannot be accessed. , all electron configurations are based on vite template files.
Directory Structure:
root
root/electron stores electron's main.js and preload.js files here.
Root/src/ is where the Vue-related vue and main.js (vue entry files) files are stored.
Electron's main.js file is about how the window object is loaded.
if (app.isPackaged) {
mainWindow.loadFile(path.join(__dirname, `../renderer/${MAIN_WINDOW_VITE_NAME}/index.html`));
mainWindow.webContents.openDevTools()
} else {
mainWindow.loadURL('http://localhost:8000/')
mainWindow.webContents.openDevTools()
}
Open the exe and check that the console is accessed in the form of E:/assets/xxx.js. The access resource does not exist. This path is definitely wrong, but everything that can be configured is configured. What is causing this problem? How should I solve this problem of not being able to access resource files?
Steps to reproduce
exec npm run make
command
Additional information
No response