mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2024-11-01 14:10:27 +08:00
107 lines
10 KiB
JavaScript
107 lines
10 KiB
JavaScript
// vite.config.mts
|
|
import { fileURLToPath, URL } from "node:url";
|
|
import vue from "file:///D:/coding/cool/admin/front-next/node_modules/.pnpm/@vitejs+plugin-vue@5.0.3_vite@5.3.4_vue@3.4.15/node_modules/@vitejs/plugin-vue/dist/index.mjs";
|
|
import vueJsx from "file:///D:/coding/cool/admin/front-next/node_modules/.pnpm/@vitejs+plugin-vue-jsx@3.1.0_vite@5.3.4_vue@3.4.15/node_modules/@vitejs/plugin-vue-jsx/dist/index.mjs";
|
|
import compression from "file:///D:/coding/cool/admin/front-next/node_modules/.pnpm/vite-plugin-compression@0.5.1_vite@5.3.4/node_modules/vite-plugin-compression/dist/index.mjs";
|
|
import { visualizer } from "file:///D:/coding/cool/admin/front-next/node_modules/.pnpm/rollup-plugin-visualizer@5.9.2/node_modules/rollup-plugin-visualizer/dist/plugin/index.js";
|
|
|
|
// src/config/proxy.ts
|
|
var proxy = {
|
|
"/dev/": {
|
|
target: "http://127.0.0.1:8001",
|
|
changeOrigin: true,
|
|
rewrite: (path) => path.replace(/^\/dev/, "")
|
|
},
|
|
"/prod/": {
|
|
target: "https://show.cool-admin.com",
|
|
changeOrigin: true,
|
|
rewrite: (path) => path.replace(/^\/prod/, "/api")
|
|
}
|
|
};
|
|
|
|
// vite.config.mts
|
|
import { cool } from "file:///D:/coding/cool/admin/front-next/node_modules/.pnpm/@cool-vue+vite-plugin@7.1.7/node_modules/@cool-vue/vite-plugin/dist/index.js";
|
|
var __vite_injected_original_import_meta_url = "file:///D:/coding/cool/admin/front-next/vite.config.mts";
|
|
function toPath(dir) {
|
|
return fileURLToPath(new URL(dir, __vite_injected_original_import_meta_url));
|
|
}
|
|
var vite_config_default = ({ mode }) => {
|
|
const isDev = mode === "development";
|
|
return {
|
|
plugins: [
|
|
vue(),
|
|
compression(),
|
|
vueJsx(),
|
|
// vueDevTools(),
|
|
cool({
|
|
type: "admin",
|
|
proxy
|
|
}),
|
|
visualizer({
|
|
open: false,
|
|
gzipSize: true,
|
|
brotliSize: true
|
|
})
|
|
],
|
|
base: "/ttt/",
|
|
server: {
|
|
port: 9e3,
|
|
proxy,
|
|
hmr: {
|
|
overlay: true
|
|
}
|
|
},
|
|
css: {
|
|
preprocessorOptions: {
|
|
scss: {
|
|
charset: false
|
|
}
|
|
}
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
"/@": toPath("./src"),
|
|
"/$": toPath("./src/modules"),
|
|
"/#": toPath("./src/plugins"),
|
|
"/~": toPath("./packages")
|
|
}
|
|
},
|
|
esbuild: {
|
|
// drop: isDev ? [] : ["console", "debugger"]
|
|
},
|
|
build: {
|
|
minify: "esbuild",
|
|
// terserOptions: {
|
|
// compress: {
|
|
// drop_console: true,
|
|
// drop_debugger: true
|
|
// }
|
|
// },
|
|
sourcemap: isDev,
|
|
rollupOptions: {
|
|
output: {
|
|
chunkFileNames: "static/js/[name]-[hash].js",
|
|
entryFileNames: "static/js/[name]-[hash].js",
|
|
assetFileNames: "static/[ext]/[name]-[hash].[ext]",
|
|
manualChunks(id) {
|
|
if (id.includes("node_modules")) {
|
|
if (!["@cool-vue/crud"].find((e) => id.includes(e))) {
|
|
if (id.includes("prettier")) {
|
|
return;
|
|
}
|
|
return id.toString().split("node_modules/")[1].replace(".pnpm/", "").split("/")[0];
|
|
} else {
|
|
return "comm";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
export {
|
|
vite_config_default as default
|
|
};
|
|
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcubXRzIiwgInNyYy9jb25maWcvcHJveHkudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9kaXJuYW1lID0gXCJEOlxcXFxjb2Rpb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