enable chrome devtools

This commit is contained in:
Labhansh Agrawal 2021-04-20 14:08:36 +05:30
parent 3bad0d4cda
commit ceaac466d7
3 changed files with 8 additions and 11 deletions

View file

@ -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

View file

@ -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",

View file

@ -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"