Version: [email protected]
Target: Any
create-react-app by default outputs to a directory named build/. With a electron-builder.yml structured like so:
files:
- electron/
- node_modules/
- build/
The build/ directory is excluded. Most likely due to some internal logic.
It's also unfortunate that setting files: really means asarFiles, and setting it manually overwrites the default values (IE you won't get node_modules/), and that there's no equivalent extraAsarFiles.
It's also unfortunate that setting files: really means asarFiles, and setting it manually overwrites the default values (IE you won't get node_modules/),
You just want to _append_ files, right?
Please change directories.output from default build to another value. In this case you also don't need to add build to files
I don't see how @develar's suggestion helps this issue. setting directories.output, say, in package.json like this:
{
"build": {
"directories": {
"output": "custom-output"
}
}
}
changes electron-builder's output folder from the default dist/ to custom-output/. It doesn't seem to affect the OP's issue (and my issue at the moment) at all (the build/ folder is still ignored). Might I be missing something?
You're not, this issue was closed without resolution.
Here's the electron-builder.yml I ended up with:
publish:
provider: s3
bucket: xxx
path: xxx
npmRebuild: false
directories:
buildResources: electron-builder
files:
- electron/
- node_modules/
- build/
- "!node_modules/.cache/"
- "!**/*.map"
@mikew God bless your cow, that worked! Thanks for sharing.
So, yes, @develar, as OP mentioned, the directory named "build" does indeed get ignored and has to be explicitly put into "files" option in configuration, like so
"build": {
"appId": "appid",
...
"files": [
"scripts/",
"node_modules/",
"build/",
"!node_modules/.cache/",
"!**/*.map"
]
}
This comes as an issue for most of the people doing a webpackbuild before packaging the things to be used with electron, and is definitely an issue for anyone who started with create-react-app.
yes, it's strange, we need add build folder to files explicitly to include this folder into the package.
I could be mistaken, but it'd be nice to see that build folder in these glob patterns on this doc page: https://www.electron.build/configuration/contents#files
Had it been there, I would've realized it was defaulted to be excluded.
What's the rationale behind excluding the 'build' folder? To me it makes sense to put all generated stuff (except maybe the final product, which is under 'release') inside it.
Most helpful comment
@mikew God bless your cow, that worked! Thanks for sharing.
So, yes, @develar, as OP mentioned, the directory named "build" does indeed get ignored and has to be explicitly put into "files" option in configuration, like so
This comes as an issue for most of the people doing a
webpackbuild before packaging the things to be used withelectron, and is definitely an issue for anyone who started withcreate-react-app.