Add some notes
The helpful snippet about the purpose of install-app-deps taken from https://webpack.electron.build/dependency-management
This commit is contained in:
parent
b7b33eba4a
commit
0e861d5c48
3 changed files with 28 additions and 0 deletions
|
@ -22,6 +22,11 @@ a _renderer_ process.
|
|||
export of the [Photos web app](../web/README.md) in the generated app. This
|
||||
gets loaded by the embedded Chromium at runtime, acting as the app's UI.
|
||||
|
||||
There is also a third environment that gets temporarily created:
|
||||
|
||||
- The [preload script](../src/preload.ts) acts as a gateway between the _main_
|
||||
and the _renderer_ process. It runs in its own isolated environment.
|
||||
|
||||
### electron-builder
|
||||
|
||||
[Electron Builder](https://www.electron.build) is used for packaging the app for
|
||||
|
|
|
@ -2,3 +2,11 @@
|
|||
|
||||
- `yarn build:quick` is a variant of `yarn build` that uses the
|
||||
`--config.compression=store` flag to (slightly) speed up electron-builder.
|
||||
|
||||
## Notes
|
||||
|
||||
- When using native node modules (those written in C/C++), we need to ensure
|
||||
they are built against `electron`'s packaged `node` version. We use
|
||||
[electron-builder](https://www.electron.build/cli)'s `install-app-deps`
|
||||
command to rebuild those modules automatically after each `yarn install` by
|
||||
invoking it in as the `preinstall` step in our package.json.
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
/**
|
||||
* @file The preload script
|
||||
*
|
||||
* The preload script runs in an isolated environment. It has access to some of
|
||||
* the Node imports. Its task is to expose these imports and other functions as
|
||||
* an object on the DOM, so that the renderer process can invoke functions that
|
||||
* live in the main (Node.js) process.
|
||||
*
|
||||
* Note that this script cannot import other code from `src/`. This is not an
|
||||
* inherent limitation, just that we'll need to transpile our TypeScript and
|
||||
* bundle it such that it can be imported from here at runtime, when this
|
||||
* preload script is run by Electron inside its half-node half-DOM isolated
|
||||
* environment.
|
||||
*/
|
||||
|
||||
import { contextBridge } from "electron";
|
||||
import {
|
||||
deleteDiskCache,
|
||||
|
|
Loading…
Add table
Reference in a new issue