Skip to content
📈0️⃣

vitepress 中配置 vite 或 vue

vite

.vitepress\config.mjs中添加如下配置

js
export default defineConfig((ctx) => {
  return {
    vite: {
      build: {
        chunkSizeWarningLimit: 600, // 设置build打包警告阈值为 600KB
      },
      esbuild: {
        pure: ["console.log"], // 删除 console.log
        drop: ["debugger"], // 删除 debugger
      },
      server: {
        proxy: {
          // 设置代理
          "/blogapi": {
            target: "https://zichin.com",
            changeOrigin: true,
            rewrite: (path) => path.replace(/^\/blogapi/, "blogapi"),
          },
        },
      },
    },
    // ...其他配置
  };
});

vue

.vitepress\config.mjs中添加如下配置

js
export default defineConfig((ctx) => {
  return {
    vue: {
      // @vitejs/plugin-vue 选项
    },
    // ...其他配置
  };
});

@vitejs/plugin-vue 选项参考-@vitejs/plugin-vue

参考