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
54
54
55
55
# show proxy url log in terminal
56
56
VITE_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 1
1
import type { PluginOption } from 'vite' ;
2
2
import vue from '@vitejs/plugin-vue' ;
3
3
import vueJsx from '@vitejs/plugin-vue-jsx' ;
4
- import VueDevtools from 'vite-plugin-vue-devtools' ;
5
4
import progress from 'vite-plugin-progress' ;
6
5
import { setupElegantRouter } from './router' ;
7
6
import { setupUnocss } from './unocss' ;
8
7
import { setupUnplugin } from './unplugin' ;
9
8
import { setupHtmlPlugin } from './html' ;
9
+ import { setupDevtoolsPlugin } from './devtools' ;
10
10
11
11
export function setupVitePlugins ( viteEnv : Env . ImportMeta , buildTime : string ) {
12
12
const plugins : PluginOption = [
13
13
vue ( ) ,
14
14
vueJsx ( ) ,
15
- VueDevtools ( ) ,
15
+ setupDevtoolsPlugin ( viteEnv ) ,
16
16
setupElegantRouter ( ) ,
17
17
setupUnocss ( viteEnv ) ,
18
18
...setupUnplugin ( viteEnv ) ,
Original file line number Diff line number Diff line change @@ -108,6 +108,8 @@ declare namespace Env {
108
108
readonly VITE_AUTOMATICALLY_DETECT_UPDATE ?: CommonType . YesOrNo ;
109
109
/** show proxy url log in terminal */
110
110
readonly VITE_PROXY_LOG ?: CommonType . YesOrNo ;
111
+ /** The launch editor */
112
+ readonly VITE_DEVTOOLS_LAUNCH_EDITOR ?: import ( 'vite-plugin-vue-devtools' ) . VitePluginVueDevToolsOptions [ 'launchEditor' ] ;
111
113
}
112
114
}
113
115
You can’t perform that action at this time.
0 commit comments