Просмотр исходного кода

chore(modules/web/vite.config.js): remove console statement and replace depreted splitVendorChunkPlugin

Xwite 2 лет назад
Родитель
Сommit
6578660b26
1 измененных файлов с 15 добавлено и 2 удалено
  1. 15 2
      modules/web/vite.config.js

+ 15 - 2
modules/web/vite.config.js

@@ -1,5 +1,5 @@
 import { fileURLToPath, URL } from "node:url";
-import { defineConfig, splitVendorChunkPlugin } from "vite";
+import { defineConfig } from "vite";
 import vue from "@vitejs/plugin-vue";
 import Icons from "unplugin-icons/vite";
 import IconsResolver from "unplugin-icons/resolver";
@@ -12,7 +12,6 @@ export default ({ mode }) =>
   defineConfig({
     plugins: [
       vue(),
-      splitVendorChunkPlugin(), // index vendor打包
       AutoImport({
         imports: ["vue", "vue-router", "pinia"],
         include: [/\.[tj]sx?$/, /\.vue$/, /\.vue\?vue/, /\.md$/],
@@ -52,4 +51,18 @@ export default ({ mode }) =>
         "@utils": fileURLToPath(new URL("./src/utils/", import.meta.url)),
       },
     },
+    esbuild: {
+      drop: ["console"],
+    },
+    build: {
+      rollupOptions: {
+        output: {
+          manualChunks: (id) => {
+            if (id.includes("node_modules")) {
+              return "vendor";
+            }
+          },
+        },
+      },
+    },
   });