diff --git a/index.html b/index.html index 8266086..b0338e2 100644 --- a/index.html +++ b/index.html @@ -11,40 +11,6 @@ name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" /> - @@ -132,35 +98,69 @@ - - + + + diff --git a/src/plugins/00.app-config.ts b/src/plugins/00.app-config.ts index 85b2b0f..830b10a 100644 --- a/src/plugins/00.app-config.ts +++ b/src/plugins/00.app-config.ts @@ -10,17 +10,4 @@ export function install({ app }: { app: import('vue').App }) { // 2. 显示全局错误提示 // 3. 进行错误分析和处理 }; - - // if (import.meta.env.MODE === 'development' && '1' === ('2' as never)) { - // // TODO: https://github.com/hu3dao/vite-plugin-debug/ - // // https://eruda.liriliri.io/zh/docs/#快速上手 - // import('eruda').then(({ default: eruda }) => { - // eruda.init({ - // defaults: { - // transparency: 0.9, - // }, - // }) - // /* eruda.show(); */ - // }) - // } } diff --git a/vite-plugins/09.index-html-plugin.ts b/vite-plugins/09.index-html-plugin.ts index fb02b98..0e2383a 100644 --- a/vite-plugins/09.index-html-plugin.ts +++ b/vite-plugins/09.index-html-plugin.ts @@ -26,7 +26,73 @@ function IndexHtmlPlugin(): PluginOption { }; } +function ___(): PluginOption { + // https://github.com/hu3dao/vite-plugin-debug/blob/2935025e8ce082b9a5aef04766bcae3e996b3e55/src/index.ts + return { + name: 'vant-touch-emulator-online', + apply: 'build', + transformIndexHtml(html) { + return { + html, + tags: [ + { + tag: 'script', + attrs: { + src: 'https://testingcf.jsdelivr.net/npm/@vant/touch-emulator/dist/index.min.js', + // 这里的 `.min.js` 是 jsDelivr 的特殊处理 + // src: 'https://unpkg.luckincdn.com/@vant/touch-emulator@1.4.0/dist/index.js', + }, + injectTo: 'body', + }, + + // >>>>> eruda + + { + tag: 'script', + attrs: { + src: 'https://testingcf.jsdelivr.net/npm/eruda/eruda.js', + }, + injectTo: 'body', + }, + { + tag: 'script', + children: `eruda.init();`, + injectTo: 'body', + }, + // https://eruda.liriliri.io/zh/docs/#快速上手 + // import('eruda').then(({ default: eruda }) => { + // eruda.init({ + // defaults: { + // transparency: 0.9, + // }, + // }) + // /* eruda.show(); */ + // }) + // } + // <<<<< + + // >>>>> vConsole + { + tag: 'script', + attrs: { + src: 'https://cdn.jsdelivr.net/npm/vconsole@latest/dist/vconsole.min.js', + }, + injectTo: 'body', + }, + { + tag: 'script', + children: `new window.VConsole();`, + injectTo: 'body', + }, + // <<<<< + ], + }; + }, + }; +} + export function loadPlugin(_configEnv: ConfigEnv): PluginOption { + // return [___()]; const env = loadEnv(_configEnv.mode, process.cwd()); if (env.VITE_BUILD_MINIFY === 'true') return IndexHtmlPlugin(); }