diff --git a/app/index.ts b/app/index.ts index 94d8fa7b..3f20dbef 100644 --- a/app/index.ts +++ b/app/index.ts @@ -64,17 +64,20 @@ if (isDev) { const url = `file://${resolve(isDev ? __dirname : app.getAppPath(), 'index.html')}`; console.log('electron will open', url); -function installDevExtensions(isDev_: boolean) { +async function installDevExtensions(isDev_: boolean) { if (!isDev_) { - return Promise.resolve([]); + return []; } - // eslint-disable-next-line @typescript-eslint/no-var-requires - const installer = require('electron-devtools-installer') as typeof import('electron-devtools-installer'); + const installer = await import('electron-devtools-installer'); const extensions = ['REACT_DEVELOPER_TOOLS', 'REDUX_DEVTOOLS'] as const; const forceDownload = Boolean(process.env.UPGRADE_EXTENSIONS); - return Promise.all(extensions.map((name) => installer.default(installer[name], forceDownload))); + return Promise.all( + extensions.map((name) => + installer.default(installer[name], {forceDownload, loadExtensionOptions: {allowFileAccess: true}}) + ) + ); } // eslint-disable-next-line @typescript-eslint/no-misused-promises diff --git a/package.json b/package.json index fdd3b2cb..951ccd7c 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,6 @@ "@types/async-retry": "1.4.2", "@types/color": "3.0.1", "@types/columnify": "^1.5.0", - "@types/electron-devtools-installer": "2.2.0", "@types/fs-extra": "9.0.11", "@types/lodash": "^4.14.168", "@types/mkdirp": "1.0.1", diff --git a/yarn.lock b/yarn.lock index 2d983373..7c16b209 100644 --- a/yarn.lock +++ b/yarn.lock @@ -738,11 +738,6 @@ resolved "https://registry.npmjs.org/@types/debug/-/debug-4.1.5.tgz#b14efa8852b7768d898906613c23f688713e02cd" integrity sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ== -"@types/electron-devtools-installer@2.2.0": - version "2.2.0" - resolved "https://registry.npmjs.org/@types/electron-devtools-installer/-/electron-devtools-installer-2.2.0.tgz#32ee4ebbe99b3daf9847a6d2097dc00b5de94f10" - integrity sha512-HJNxpaOXuykCK4rQ6FOMxAA0NLFYsf7FiPFGmab0iQmtVBHSAfxzy3MRFpLTTDDWbV0yD2YsHOQvdu8yCqtCfw== - "@types/eslint-scope@^3.7.0": version "3.7.0" resolved "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.0.tgz#4792816e31119ebd506902a482caec4951fabd86"