Skip to content

Commit 3774248

Browse files
committed
feat(generator): enable vue devtools on electron 8/9
1 parent e4d9625 commit 3774248

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

generator/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ module.exports = (api, options = {}) => {
1212
fs.existsSync(api.resolve('./src/background.ts')) ||
1313
fs.existsSync(api.resolve('./src/background.js'))
1414

15-
const devtoolsExtensionsBroken = semver.gte(
15+
const devtoolsExtensionsBroken = semver.satisfies(
1616
(electronVersion || pkg.devDependencies.electron).replace('^', ''),
17-
'6.0.0'
17+
'^6.0.0||^7.0.0'
1818
)
1919
if (devtoolsExtensionsBroken) {
20-
warn('Devtools extensions are broken in Electron 6.0.0 and greater')
20+
warn(
21+
'Devtools extensions are broken in Electron versions 6/7/<8.2.5 on Windows'
22+
)
2123
warn(
2224
'Vue Devtools have been disabled, see the comments in your background file for more info'
2325
)

generator/templates/base/src/background.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,22 @@ app.on('activate', () => {
6161
app.on('ready', async () => {
6262
if (isDevelopment && !process.env.IS_TEST) {
6363
// Install Vue Devtools
64-
<% if (devtoolsExtensionsBroken) { %>// Devtools extensions are broken in Electron 6.0.0 and greater
64+
<% if (devtoolsExtensionsBroken) { %>// Devtools extensions are broken in Electron 6/7/<8.25 on Windows
6565
// See https://github.com/nklayman/vue-cli-plugin-electron-builder/issues/378 for more info
6666
// Electron will not launch with Devtools extensions installed on Windows 10 with dark mode
67-
// If you are not using Windows 10 dark mode, you may uncomment these lines
68-
// In addition, if the linked issue is closed, you can upgrade electron and uncomment these lines
67+
// If you are not using Windows 10 dark mode, you may uncomment the following lines (and the import at the top of the file)
68+
// In addition, if you upgrade to Electron ^8.2.5 or ^9.0.0 then devtools should work fine
69+
6970
// try {
7071
// await installVueDevtools()
7172
// } catch (e) {
7273
// console.error('Vue Devtools failed to install:', e.toString())
7374
// }
7475
<% } else { %>try {
75-
await installVueDevtools()
76-
} catch (e) {
77-
console.error('Vue Devtools failed to install:', e.toString())
78-
}
79-
<% } %>
76+
await installVueDevtools()
77+
} catch (e) {
78+
console.error('Vue Devtools failed to install:', e.toString())
79+
}<% } %>
8080
}
8181
createWindow()
8282
})

0 commit comments

Comments
 (0)