See also: create-react-app-electron-boilerplate
electron: Directory for Electron (Node.js) source codesrc: Directory for React source codebuild: Directory for building the source code abovedist: Directory for building production apptsconfig.json: TypeScript build config for Reacttsconfig.electron.json: TypeScript build config for Electronrollup.config.js: For bundling files inelectrondirectory to one file [build/electron.js]
npm startBuild the React app to build directory:
npm run react-buildBundle files in electron directory to one file
build/electron.js
(preload.js will also be copied to build directory):
npm run electron-bundlePackage the Electron app:
npm run electron-packThe packaged application will be in the dist directory.
See the documentation of electron-builder and
the build part of package.json.
Put them in the extraResources directory.
The files can be found in the resources/extraResources directory
of the packaged application (Contents/Resources/extraResources
for MacOS).
To access this folder in your app you can do:
const isDev = window.require('electron-is-dev')
const pathAppResources = `${isDev ? '.' : window.process.resourcesPath}/extraResources/`