cool-admin-vue/vite.config.mts.timestamp-1722222863909-a8e85574a7f33.mjs

107 lines
10 KiB
JavaScript
Raw Normal View History

2024-07-29 11:28:48 +08:00
// 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,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcubXRzIiwgInNyYy9jb25maWcvcHJveHkudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9kaXJuYW1lID0gXCJEOlxcXFxjb2RpbmdcXFxcY29vbFxcXFxhZG1pblxcXFxmcm9udC1uZXh0XCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ZpbGVuYW1lID0gXCJEOlxcXFxjb2RpbmdcXFxcY29vbFxcXFxhZG1pblxcXFxmcm9udC1uZXh0XFxcXHZpdGUuY29uZmlnLm10c1wiO2NvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9pbXBvcnRfbWV0YV91cmwgPSBcImZpbGU6Ly8vRDovY29kaW5nL2Nvb2wvYWRtaW4vZnJvbnQtbmV4dC92aXRlLmNvbmZpZy5tdHNcIjtpbXBvcnQgeyBmaWxlVVJMVG9QYXRoLCBVUkwgfSBmcm9tIFwibm9kZTp1cmxcIjtcbmltcG9ydCB7IENvbmZpZ0VudiwgVXNlckNv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