Skip to content

Commit 61a8d78

Browse files
erickzhaogitbook-bot
authored andcommitted
GITBOOK-214: Forge 7.9 updates
1 parent 5a0f9d4 commit 61a8d78

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

config/plugins/vite.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ module.exports = {
6262
{% endtab %}
6363

6464
{% tab title="package.json" %}
65-
```jsonc
65+
```json
6666
{
6767
// ...
6868
"config": {
@@ -107,7 +107,7 @@ Vite's build config generates a separate entry for the main process and preload
107107
Your `main` entry in your `package.json` file needs to point at `".vite/build/main"`, like so:
108108

109109
{% code title="package.json" %}
110-
```jsonc
110+
```json
111111
{
112112
"name": "my-vite-app",
113113
"main": ".vite/build/main.js",
@@ -120,6 +120,28 @@ If using the Vite template, this should be automatically set up for you.
120120

121121
## Advanced configuration
122122

123+
### Build concurrency
124+
125+
Under the hood, the Vite plugin spawns a separate Vite build for each target. These builds first run in parallel for all renderer targets, then for all main and preload targets. Vite can sometimes use a lot of memory, and having many builds simultaneously can cause Out of Memory issues (see [vitejs/vite#2433](https://github.com/vitejs/vite/issues/2433)).
126+
127+
Starting from Forge v7.9.0, you can pass a boolean or integer value to the plugin's `concurrent` option to limit how many build jobs run at once to alleviate memory issues.
128+
129+
{% code title="forge.config.js" %}
130+
```javascript
131+
module.exports = {
132+
plugins: {
133+
name: '@electron-forge/plugin-vite',
134+
config: {
135+
build: [/*...*/],
136+
renderer: [/*...*/],
137+
concurrent: false // accepts a boolean or positive integer
138+
}
139+
}
140+
};
141+
142+
```
143+
{% endcode %}
144+
123145
### Native Node modules
124146

125147
If you used the [Vite](../../templates/vite.md) template to create your application, native modules will mostly work out of the box. However, to avoid possible build issues, we recommend instructing Vite to load them as external packages:

0 commit comments

Comments
 (0)