Add the following code to package.json:
"build": {
"extraResources": [
{
"from": "./src/extraResources/",
"to": "extraResources",
"filter": [
"**/*"
]
}
]
}
Then, you can access the files using
const configFile = path.join(path.dirname(__dirname), 'extraResources','config.json');
I use the following folders structure which allows me to run the app any way.
from project folder:
node_modules.binelectron.cmd srcmainindex.js
from unpacked source
distwin-unpackedapp.exe check-for-update
from installed folder
C:UsersuserAppDataLocalProgramsappapp.exe
+-- dist
| +-- win-unpacked
| +-- resources
| +-- extraResources
| config.json
+-- node_modules
+-- src
| +-- extraResources
| config.json
| someFile.js
| +-- main
| index.js
| +-- render
| index.js
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…