Skip to content

Commit

Permalink
docs(electron): update the way QUASAR_NODE_INTEGRATION should be used q…
Browse files Browse the repository at this point in the history
  • Loading branch information
pdanpdan committed Jul 8, 2020
1 parent eac838a commit b13520e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 2 additions & 0 deletions docs/src/pages/quasar-cli/app-upgrade-guide.md
Expand Up @@ -93,6 +93,8 @@ Following this guide should take you at most 5 minutes to complete.
app.use(ssr.resolveUrl('<path>'), ...)
```

* If you are building with Electron replace `QUASAR_NODE_INTEGRATION` in your main thread file (/src-electron/main-process/main.js) with `process.env.QUASAR_NODE_INTEGRATION` (if it is present)

### Optional steps

The following steps are optional, but recommended.
Expand Down
Expand Up @@ -24,7 +24,8 @@ function createWindow () {
mainWindow = new BrowserWindow({
// ...
webPreferences: {
nodeIntegration: QUASAR_NODE_INTEGRATION,
nodeIntegration: process.env.QUASAR_NODE_INTEGRATION,
nodeIntegrationInWorker: process.env.QUASAR_NODE_INTEGRATION,

// HERE IS THE MAGIC:
preload: path.resolve(__dirname, 'electron-preload.js')
Expand Down
Expand Up @@ -43,10 +43,24 @@ electron: {
```

::: tip
Starting with "@quasar/app" v1.7+ you can edit your main thread file to set `nodeIntegration: QUASAR_NODE_INTEGRATION`. The `QUASAR_NODE_INTEGRATION` is a macro injected by Quasar so that you'll have only one place to edit your Node Integration state: quasar.conf.js.
Starting with "@quasar/app" v2.0+ you can edit your main thread file to set `nodeIntegration: process.env.QUASAR_NODE_INTEGRATION`. The `QUASAR_NODE_INTEGRATION` env variable is injected by Quasar so that you'll have only one place to edit your Node Integration state: quasar.conf.js.
:::

### Legacy warning
### Legacy warnings

**If your version of "@quasar/app" is greater than v1.7 and lower than v2.0**, then you also need to use `QUASAR_NODE_INTEGRATION` in your main thread file (/src-electron/main-process/main.js):

```js
// file: /src-electron/main-process/main.js

mainWindow = new BrowserWindow({
// ..

webPreferences: {
nodeIntegration: QUASAR_NODE_INTEGRATION
}
})
```

**If your version of "@quasar/app" is lower than v1.7**, then you also need to edit your main thread file (/src-electron/main-process/main.js):

Expand Down

0 comments on commit b13520e

Please sign in to comment.