I have a file that should be changable without needing to rebuild the project.
I'm therefore using the extraResources
located in:
.
├── extraResources
│ └── flags.json
├── src
├── package.json
└── ...
For the build process my package.json
contains the following:
{
"build": {
"extraResources": [
"./extraResources/**"
]
}
}
This part seems to work since in the build output I get the extraResources
in dist/win-unpacked/resources/extraResources/flags.json
.
The above was done following this: https://stackoverflow.com/a/46033483/2230045
I'm loading this file via:
const filepath = path.join(app.getAppPath(), 'extraResources', 'flags.json');
const data = fs.readFileSync(filepath, 'utf-8');
This works fine during debugging but after the build, it fails with:
Uncaught Exception: Error: ENOENT, extraResources\flags.json not found in C:\dev\MyProgram\dist\win-unpacked\resources\app.asar
It is not clear to me why this is not working while it seemingly works for others.
Based on a hint from here I tried using hazardous but that did not help.