Skip to content

Commit

Permalink
pack: only install extension in debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jooy2 committed Oct 24, 2023
1 parent 6faea38 commit d630a82
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions buildAssets/builder/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ baseConfig.files = [
(Required) The files and folders listed below should not be included in the build.
*/
'dist/**/*',
'!dist/main/index.dev.js',
'!docs/**/*',
'!tests/**/*',
'!release/**/*'
Expand Down
10 changes: 10 additions & 0 deletions src/main/index.dev.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Warning: This file is only used in the development environment
// and is removed at build time.
// Do not edit the file unless necessary.
import { installExtension, VUEJS_DEVTOOLS } from 'electron-extension-installer'

installExtension(VUEJS_DEVTOOLS, {
loadExtensionOptions: {
allowFileAccess: true
}
})
7 changes: 1 addition & 6 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@ import { app, WebContents, RenderProcessGoneDetails } from 'electron'
import Constants from './utils/Constants'
import { createErrorWindow, createMainWindow } from './MainRunner'
import { macOSDisableDefaultMenuItem } from './utils/Menus'
import { installExtension, VUEJS_DEVTOOLS } from 'electron-extension-installer'

let mainWindow
let errorWindow

app.on('ready', async () => {
if (Constants.IS_DEV_ENV) {
await installExtension(VUEJS_DEVTOOLS, {
loadExtensionOptions: {
allowFileAccess: true
}
})
import('./index.dev')
}
macOSDisableDefaultMenuItem()

Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default defineConfig(() => {
// Docs: https://github.com/electron-vite/vite-plugin-electron
ElectronPlugin([
{
entry: ['src/main/index.ts'],
entry: ['src/main/index.ts', 'src/main/index.dev.ts'],
onstart: (options) => {
options.startup()
},
Expand Down

0 comments on commit d630a82

Please sign in to comment.