Question about files/extraFiles/extraResources
See original GitHub issueversion: 20.4.1
I’m having trouble understanding some problems and restrictions that I ran into with files/extraFiles/extraResources configuration. I’ve read all possible documentations that I could find, and it still isn’t clear to me. Please help me understand.
Assuming the following project structure:
project
├── app
│ ├── index.html
│ └── index.js
├── electron
│ ├── main.js
│ ├── pack.js
│ └── package.json
└── package.json
/app
is the application that I wish to release as a web application AND package as an electron app.
/electron
is a packaging helper project that uses electron-builder
; it is also the “app root” for electron-builder
/electron/pack.js
is a node script that runs the electron-builder
api.
Now the question is, how do I include files from /app
into the electron app?
- I read in several places (eg. #597) that the paths should be “relative to the (electron) project directory”. The term “relative” usually means that I should be able to specify something like
'../app/**/*'
– this is a valid relative path. However I don’t think “relative” means what I think it means in this case. It seems like “relative” means that the file/directory must be contained within the electron project directory. Please correct me if I’m wrong. - If files must be from within the electron project directory, maybe “relative” is not the most accurate term to use? It is really easy to think that I could specify either relative or absolute path for files/extraFiles/extraResource, but this clearly doesn’t work for files outside of the electron project directory.
- Why can’t I use absolute path or relative path that points outside of the electron project? I know nothing about how build-electron works underneath, but I thought we’re simply copying files and directories, so I really don’t understand why there is such restriction.
NOTE: I discovered the following while I was testing and writing up this issue:
Relative path will only work if you use Fileset.from
, and it cannot be a glob pattern
This works
files: [
{from: '../app/', to: '.'}
]
This doesn’t work (Fileset
+ glob pattern)
files: [
{from: '../app/**/*', to: '.'}
]
This doesn’t work (relative path without using Fileset
)
files: [
'../app/'
]
I feel this is something that developers should be able to know by reading the documentation, but I had to figure it out through trial and error. Hope this will be useful to others who happen to across the same issue.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:20
- Comments:10 (1 by maintainers)
Top GitHub Comments
I would really like to see a warning when use String or Array String and files are missing also.
Is there a way to make electron-builder treat warnings as errors?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.