feat(vite-plugin-vue-devtools): 优化Vue DevTools插件加载逻辑

This commit is contained in:
严浩
2025-10-26 00:42:22 +08:00
parent faef37f457
commit e251efff65

View File

@@ -5,10 +5,14 @@ import vueDevTools from 'vite-plugin-vue-devtools';
export function loadPlugin(configEnv: ConfigEnv): PluginOption { export function loadPlugin(configEnv: ConfigEnv): PluginOption {
const env = loadEnv(configEnv.mode, process.cwd()); const env = loadEnv(configEnv.mode, process.cwd());
if (env.VITE_ENABLE_VUE_DEVTOOLS === 'true') { if (configEnv.command === 'build') {
return [vueDevTools()]; consola.info('VITE_ENABLE_VUE_DEVTOOLS is not enabled in build mode.');
} else {
consola.info('VITE_ENABLE_VUE_DEVTOOLS is not enabled.');
return []; return [];
} }
if (env.VITE_ENABLE_VUE_DEVTOOLS === 'true') {
return [];
}
return [vueDevTools()];
} }