File tree Expand file tree Collapse file tree 4 files changed +17
-2
lines changed Expand file tree Collapse file tree 4 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -54,3 +54,7 @@ VITE_AUTOMATICALLY_DETECT_UPDATE=Y
5454
5555# show proxy url log in terminal
5656VITE_PROXY_LOG = Y
57+
58+ # used to control whether to launch editor
59+ # by the way, this plugin is only available in dev mode, not in build mode
60+ VITE_DEVTOOLS_LAUNCH_EDITOR = code
Original file line number Diff line number Diff line change 1+ import VueDevtools from 'vite-plugin-vue-devtools' ;
2+
3+ export function setupDevtoolsPlugin ( viteEnv : Env . ImportMeta ) {
4+ const { VITE_DEVTOOLS_LAUNCH_EDITOR } = viteEnv ;
5+
6+ return VueDevtools ( {
7+ launchEditor : VITE_DEVTOOLS_LAUNCH_EDITOR
8+ } ) ;
9+ }
Original file line number Diff line number Diff line change 11import type { PluginOption } from 'vite' ;
22import vue from '@vitejs/plugin-vue' ;
33import vueJsx from '@vitejs/plugin-vue-jsx' ;
4- import VueDevtools from 'vite-plugin-vue-devtools' ;
54import progress from 'vite-plugin-progress' ;
65import { setupElegantRouter } from './router' ;
76import { setupUnocss } from './unocss' ;
87import { setupUnplugin } from './unplugin' ;
98import { setupHtmlPlugin } from './html' ;
9+ import { setupDevtoolsPlugin } from './devtools' ;
1010
1111export function setupVitePlugins ( viteEnv : Env . ImportMeta , buildTime : string ) {
1212 const plugins : PluginOption = [
1313 vue ( ) ,
1414 vueJsx ( ) ,
15- VueDevtools ( ) ,
15+ setupDevtoolsPlugin ( viteEnv ) ,
1616 setupElegantRouter ( ) ,
1717 setupUnocss ( viteEnv ) ,
1818 ...setupUnplugin ( viteEnv ) ,
Original file line number Diff line number Diff line change @@ -108,6 +108,8 @@ declare namespace Env {
108108 readonly VITE_AUTOMATICALLY_DETECT_UPDATE ?: CommonType . YesOrNo ;
109109 /** show proxy url log in terminal */
110110 readonly VITE_PROXY_LOG ?: CommonType . YesOrNo ;
111+ /** The launch editor */
112+ readonly VITE_DEVTOOLS_LAUNCH_EDITOR ?: import ( 'vite-plugin-vue-devtools' ) . VitePluginVueDevToolsOptions [ 'launchEditor' ] ;
111113 }
112114}
113115
You can’t perform that action at this time.
0 commit comments