File tree Expand file tree Collapse file tree 2 files changed +20
-18
lines changed
Expand file tree Collapse file tree 2 files changed +20
-18
lines changed Original file line number Diff line number Diff line change @@ -312,26 +312,28 @@ export function useVSCodePlugin(options?: PluginOptions): PluginOption {
312312 return html ;
313313 }
314314
315- const devtools = opts . devtools ?? true ;
316- let port : number | undefined ;
317- if ( typeof devtools === 'number' ) {
318- port = devtools ;
319- }
320- else if ( devtools === true ) {
321- if ( resolvedConfig . plugins . find ( s => [ 'vite:vue' , 'vite:vue2' ] . includes ( s . name ) ) ) {
322- port = 8098 ;
315+ const devtools = opts . devtools ;
316+ if ( devtools ) {
317+ let port : number | undefined ;
318+ if ( typeof devtools === 'number' ) {
319+ port = devtools ;
323320 }
324- else if ( resolvedConfig . plugins . find ( s => [ 'vite:react-refresh' , 'vite:react-swc' ] . includes ( s . name ) ) ) {
325- port = 8097 ;
321+ else if ( devtools === true ) {
322+ if ( resolvedConfig . plugins . find ( s => [ 'vite:vue' , 'vite:vue2' ] . includes ( s . name ) ) ) {
323+ port = 8098 ;
324+ }
325+ else if ( resolvedConfig . plugins . find ( s => [ 'vite:react-refresh' , 'vite:react-swc' ] . includes ( s . name ) ) ) {
326+ port = 8097 ;
327+ }
326328 }
327- }
328329
329- if ( port ) {
330- html = html . replace ( / < h e a d > / i, `<head><script src="http://localhost:${ port } "></script>` ) ;
331- }
332- else if ( devtools && ! devtoolsFlag ) {
333- devtoolsFlag = true ;
334- logger . warn ( 'Only support react-devtools and vue-devtools!' ) ;
330+ if ( port ) {
331+ html = html . replace ( / < h e a d > / i, `<head><script src="http://localhost:${ port } "></script>` ) ;
332+ }
333+ else if ( ! devtoolsFlag ) {
334+ devtoolsFlag = true ;
335+ logger . warn ( 'Only support react-devtools and vue-devtools!' ) ;
336+ }
335337 }
336338
337339 return html . replace ( / < h e a d > / i, `<head><script>${ devWebviewClientCode } </script>` ) ;
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ export interface PluginOptions {
7474 * - react: inject `<script src="http://localhost:8097"></script>`
7575 * - vue: inject `<script src="http://localhost:8098"></script>`
7676 * - `number`: custom port
77- * @default true
77+ * @default false
7878 */
7979 devtools ?: boolean | number ;
8080}
You can’t perform that action at this time.
0 commit comments