本文介绍: 3、在vite.config.ts配置。2、在main.ts引入使用

1、npm install vconsole

2、在main.ts引入使用

 

 3、在vite.config.ts配置

export default ({mode}:any)=>{
  return defineConfig({
  base:'./',
  plugins: [
    vue(),

    Components({
      resolvers: [VantResolver()],
    }),
    viteVConsole({
      entry: path.resolve('src/main.js'), // 入口文件,或者可以使用这个配置: [path.resolve('src/main.js')]
      localEnabled: mode === 'test', // 本地是否启用
      enabled: mode === 'test', // 是否启用
      config: {
        maxLogNumber: 1000,
        theme: 'light' // 主题颜色 'dark'|'light'
      }
    })
  ],
  resolve: {
    alias: {
      "@": fileURLToPath(new URL("./src", import.meta.url)),
    },
  },
  build: {
    chunkSizeWarningLimit: 1000,
    // assetPublicPath:"./",
    rollupOptions: {
      output: {
        // 分包
        manualChunks(id) {
          if (id.includes("node_modules")) {
            return id
              .toString()
              .split("node_modules/")[1]
              .split("/")[0]
              .toString();
          }
        },
      },
    },
  
  },
  })
}

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注