From b13520e1ccc6de6266444d0f68e4f868511d3ebb Mon Sep 17 00:00:00 2001 From: Dan Popescu Date: Wed, 8 Jul 2020 10:26:40 +0300 Subject: [PATCH] docs(electron): update the way QUASAR_NODE_INTEGRATION should be used #6893 --- docs/src/pages/quasar-cli/app-upgrade-guide.md | 2 ++ .../electron-preload-script.md | 3 ++- .../node-integration.md | 18 ++++++++++++++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/docs/src/pages/quasar-cli/app-upgrade-guide.md b/docs/src/pages/quasar-cli/app-upgrade-guide.md index e18cb86a043e..6ed57c5eafa1 100644 --- a/docs/src/pages/quasar-cli/app-upgrade-guide.md +++ b/docs/src/pages/quasar-cli/app-upgrade-guide.md @@ -93,6 +93,8 @@ Following this guide should take you at most 5 minutes to complete. app.use(ssr.resolveUrl(''), ...) ``` +* 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. diff --git a/docs/src/pages/quasar-cli/developing-electron-apps/electron-preload-script.md b/docs/src/pages/quasar-cli/developing-electron-apps/electron-preload-script.md index 9652350f9565..270ed1e6aff7 100644 --- a/docs/src/pages/quasar-cli/developing-electron-apps/electron-preload-script.md +++ b/docs/src/pages/quasar-cli/developing-electron-apps/electron-preload-script.md @@ -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') diff --git a/docs/src/pages/quasar-cli/developing-electron-apps/node-integration.md b/docs/src/pages/quasar-cli/developing-electron-apps/node-integration.md index 60e55ea3667e..d6c042407b66 100644 --- a/docs/src/pages/quasar-cli/developing-electron-apps/node-integration.md +++ b/docs/src/pages/quasar-cli/developing-electron-apps/node-integration.md @@ -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):