Upon packaging my Electron app using Electron Forge, I need to have a folder inside the package folder and need to reference to that folder in my application:
Example:
Create a folder named "source" inside this directory:
To this:
Is this possible?
I found a way that would copy a folder in the resources folder using "extraResource"
in forge's "packagerConfig"
but I don't know how or if I can reference to that folder.
So I could not find a way to create or copy a folder in the root directory of the package, so I just explored using "extraResource"
in forge's "packagerConfig"
. Apparently I can reference to that folder.
To make sure it works in both dev and production environments, just create the same structure in your app:
${app_root}/resources/source
(I actually renamed 'source' but retained this to be clear)
And just reference it the usual way. Then in your package.json:
"config": {
"forge": {
"packagerConfig": {
"name": "MyApp",
"extraResource": "resources/source"
}
...
Once you package your app (npm run package
), you should see the "source" folder copied in the resources folder of your packaged electron app.
Marking this as the answer for now unless there really is a way.