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 7, 2020
1 parent 7ed8507 commit e701d7a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
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.

This comment has been minimized.

Copy link
@webnoob

webnoob Jul 8, 2020

@pdanpdan Shouldn't this be more than a recommendation? It's breaking without it so "you can" should probably be more definite.

This comment has been minimized.

Copy link
@pdanpdan

pdanpdan Jul 8, 2020

Author Owner

Is if failing if the line is not present? I thought it's failing because there is no QUASAR_NODE_INTEGRATION anymore.
Please check and let me know.

This comment has been minimized.

Copy link
@webnoob

webnoob Jul 8, 2020

That's correct. QUASAR_NODE_INTEGRATION doesn't exist and it needs to be changed to process.env.QUASAR_NODE_INTEGRATION to work.

The documentation makes it seem more of a suggestion to change it rather than a requirement but given it won't work without changing it, I think the docs should be stronger in what it says.

This comment has been minimized.

Copy link
@pdanpdan

pdanpdan Jul 8, 2020

Author Owner

No, this documentation is not the upgrade guide, it's the node-integration doc, and it specifies that you can add that line.
I just added the patch for the upgrade guide

This comment has been minimized.

Copy link
@webnoob

webnoob Jul 8, 2020

Oh, I see now. Yes, you're right. Sorry 🤦‍♂️

:::

### 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 e701d7a

Please sign in to comment.