mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(@vant/cli): add enableVConsole option (#9527)
This commit is contained in:
parent
3a8bb909fd
commit
751a263999
@ -260,6 +260,13 @@ module.exports = {
|
||||
|
||||
配置 HTML 中的 meta 标签,对象的 key 为 name,value 为 content。
|
||||
|
||||
### site.enableVConsole
|
||||
|
||||
- Type: `boolean`
|
||||
- Default: `false`
|
||||
|
||||
是否在 dev 时开启 [vConsole](https://github.com/Tencent/vConsole) 调试,用于移动端 debug。
|
||||
|
||||
## Babel
|
||||
|
||||
通过根目录下的`babel.config.js`文件可以对 Babel 进行配置。
|
||||
|
@ -13,6 +13,12 @@
|
||||
<meta http-equiv="Cache-Control" content="no-cache" />
|
||||
<meta http-equiv="Pragma" content="no-cache" />
|
||||
<meta http-equiv="Expires" content="0" />
|
||||
<% if (enableVConsole) { %>
|
||||
<script src="https://unpkg.com/vconsole/dist/vconsole.min.js"></script>
|
||||
<script>
|
||||
var vConsole = new window.VConsole();
|
||||
</script>
|
||||
<% } %>
|
||||
<% if (baiduAnalytics) { %>
|
||||
<script>
|
||||
// avoid to load analytics in iframe
|
||||
|
@ -4,7 +4,7 @@ import hljs from 'highlight.js';
|
||||
import vitePluginMd from 'vite-plugin-md';
|
||||
import vitePluginVue from '@vitejs/plugin-vue';
|
||||
import vitePluginJsx from '@vitejs/plugin-vue-jsx';
|
||||
import { setBuildTarget, getVantConfig } from '../common';
|
||||
import { setBuildTarget, getVantConfig, isDev } from '../common';
|
||||
import {
|
||||
SITE_DIST_DIR,
|
||||
SITE_MOBILE_SHARED_FILE,
|
||||
@ -79,6 +79,7 @@ export function getViteConfigForSiteDev(): InlineConfig {
|
||||
const siteConfig = getSiteConfig(vantConfig);
|
||||
const title = getTitle(siteConfig);
|
||||
const baiduAnalytics = get(vantConfig, 'site.baiduAnalytics');
|
||||
const enableVConsole = isDev() && get(vantConfig, 'site.enableVConsole');
|
||||
|
||||
return {
|
||||
root: SITE_SRC_DIR,
|
||||
@ -110,6 +111,7 @@ export function getViteConfigForSiteDev(): InlineConfig {
|
||||
...siteConfig,
|
||||
title,
|
||||
baiduAnalytics,
|
||||
enableVConsole,
|
||||
meta: getHTMLMeta(vantConfig),
|
||||
},
|
||||
}),
|
||||
|
Loading…
x
Reference in New Issue
Block a user