diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2021-07-22 17:12:49 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2021-07-23 13:39:21 +0200 |
| commit | 9c335bda35880747bf44d4b01fdca3248ea1dfb2 (patch) | |
| tree | a674e8f525f25dd7e6cc6becc3ce1e3f61130e7d /gui/src/main | |
| parent | c9d0558711a081ef25f0de1d2941061e6b46e986 (diff) | |
| download | mullvadvpn-9c335bda35880747bf44d4b01fdca3248ea1dfb2.tar.xz mullvadvpn-9c335bda35880747bf44d4b01fdca3248ea1dfb2.zip | |
Replace require expression with import expression
Diffstat (limited to 'gui/src/main')
| -rw-r--r-- | gui/src/main/index.ts | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts index 54ea32932f..c03d917018 100644 --- a/gui/src/main/index.ts +++ b/gui/src/main/index.ts @@ -1598,19 +1598,16 @@ class ApplicationMain { } private async installDevTools() { - // eslint-disable-next-line @typescript-eslint/no-var-requires - const installer = require('electron-devtools-installer'); - const extensions = ['REACT_DEVELOPER_TOOLS', 'REDUX_DEVTOOLS']; + const { default: installer, REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS } = await import( + 'electron-devtools-installer' + ); const forceDownload = !!process.env.UPGRADE_EXTENSIONS; - for (const name of extensions) { - try { - await installer.default(installer[name], { - forceDownload, - loadExtensionOptions: { allowFileAccess: true }, - }); - } catch (e) { - log.info(`Error installing ${name} extension: ${e.message}`); - } + const options = { forceDownload, loadExtensionOptions: { allowFileAccess: true } }; + try { + await installer(REACT_DEVELOPER_TOOLS, options); + await installer(REDUX_DEVTOOLS, options); + } catch (e) { + log.info(`Error installing extension: ${e.message}`); } } |
