Skip to content

Commit b37bab7

Browse files
committed
build: improve local dx
1 parent 9e77f2d commit b37bab7

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

packages/core/playground/vite.config.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import process from 'node:process'
22
import Vue from '@vitejs/plugin-vue'
33
import { defineConfig } from 'vite'
4+
// eslint-disable-next-line ts/ban-ts-comment
5+
// @ts-ignore ignore the type error
6+
import { DevToolsViteUI } from '../../vite/src/node'
47
import { DevTools } from '../src'
58
import { buildCSS } from '../src/client/webcomponents/scripts/build-css'
69

@@ -22,7 +25,10 @@ export default defineConfig({
2225
},
2326

2427
// For local playground only. As a user you don't install this plugin directly.
25-
DevTools(),
28+
DevTools({
29+
builtinDevTools: false,
30+
}),
31+
DevToolsViteUI(),
2632
{
2733
name: 'local',
2834
devtools: {

packages/core/src/node/plugins/index.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
import type { Plugin } from 'vite'
2-
// eslint-disable-next-line ts/ban-ts-comment
3-
// @ts-ignore ignore the type error
4-
import { DevToolsViteUI } from '@vitejs/devtools-vite'
52
import { DevToolsInjection } from './injection'
63
import { DevToolsServer } from './server'
74

@@ -14,7 +11,7 @@ export interface DevToolsOptions {
1411
builtinDevTools?: boolean
1512
}
1613

17-
export function DevTools(options: DevToolsOptions = {}): Plugin[] {
14+
export async function DevTools(options: DevToolsOptions = {}): Promise<Plugin[]> {
1815
const {
1916
builtinDevTools = true,
2017
} = options
@@ -25,7 +22,9 @@ export function DevTools(options: DevToolsOptions = {}): Plugin[] {
2522
]
2623

2724
if (builtinDevTools) {
28-
plugins.push(DevToolsViteUI())
25+
// eslint-disable-next-line ts/ban-ts-comment
26+
// @ts-ignore ignore the type error
27+
plugins.push(await import('@vitejs/devtools-vite').then(m => m.DevToolsViteUI()))
2928
}
3029

3130
return plugins
@@ -34,5 +33,4 @@ export function DevTools(options: DevToolsOptions = {}): Plugin[] {
3433
export {
3534
DevToolsInjection,
3635
DevToolsServer,
37-
DevToolsViteUI,
3836
}

0 commit comments

Comments
 (0)