Skip to content

Commit 5f10ad8

Browse files
committed
feat(generator/background.js): use vue3 devtools if project uses vue 3, fixes #1431
1 parent 6cf1bde commit 5f10ad8

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

generator/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ module.exports = (api, options = {}) => {
1414
if (!hasBackground) {
1515
// If user does not have a background file it should be created
1616
api.render('./templates/base', {
17-
spectronSupport: options.electronBuilder.addTests
17+
spectronSupport: options.electronBuilder.addTests,
18+
vue3: /^(\^?)3/.test(pkg.dependencies.vue)
1819
})
1920
}
2021
// Add tests

generator/templates/base/src/background.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { app, protocol, BrowserWindow } from 'electron'
44
import { createProtocol } from 'vue-cli-plugin-electron-builder/lib'
5-
import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
5+
import installExtension, { VUEJS<% if (vue3) { %>3<%}%>_DEVTOOLS } from 'electron-devtools-installer'
66
const isDevelopment = process.env.NODE_ENV !== 'production'
77

88
// Scheme must be registered before the app is ready
@@ -60,7 +60,7 @@ app.on('ready', async () => {
6060
if (isDevelopment && !process.env.IS_TEST) {
6161
// Install Vue Devtools
6262
try {
63-
await installExtension(VUEJS_DEVTOOLS)
63+
await installExtension(VUEJS<% if (vue3) { %>3<%}%>_DEVTOOLS)
6464
} catch (e) {
6565
console.error('Vue Devtools failed to install:', e.toString())
6666
}

0 commit comments

Comments
 (0)