1 Star 0 Fork 0

邓晓楠/cool-admin-vue

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vite.config.mts 1.87 KB
一键复制 编辑 原始数据 按行查看 历史
神仙都没用 提交于 2024-04-26 21:28 . 更新 eps 构建方式
import path from "path";
import { ConfigEnv, UserConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import compression from "vite-plugin-compression";
import { visualizer } from "rollup-plugin-visualizer";
import { proxy } from "./src/config/proxy";
import { cool } from "@cool-vue/vite-plugin";
function resolve(dir: string) {
return path.resolve(__dirname, ".", dir);
}
function isDev(mode: string | undefined): boolean {
return mode === "development";
}
// https://vitejs.dev/config
export default ({ mode }: ConfigEnv): UserConfig => {
return {
plugins: [
vue(),
compression(),
vueJsx(),
cool({
type: "admin",
proxy
}),
visualizer({
open: false,
gzipSize: true,
brotliSize: true
})
],
base: "/",
server: {
port: 9000,
proxy,
hmr: {
overlay: true
}
},
css: {
preprocessorOptions: {
scss: {
charset: false
}
}
},
resolve: {
alias: {
"/@": resolve("src"),
"/$": resolve("src/modules"),
"/#": resolve("src/plugins"),
"/~": resolve("packages")
}
},
esbuild: {
drop: isDev(mode) ? [] : ["console", "debugger"]
},
build: {
minify: "esbuild",
// terserOptions: {
// compress: {
// drop_console: true,
// drop_debugger: true
// }
// },
sourcemap: isDev(mode),
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))) {
let str = id.toString().split("node_modules/")[1];
if (str[0] == "@") {
str = str.replace("/", ".");
}
return str.split("/")[0].toString();
}
}
}
}
}
}
};
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/dengtianlang/cool-admin-vue.git
git@gitee.com:dengtianlang/cool-admin-vue.git
dengtianlang
cool-admin-vue
cool-admin-vue
7.x

搜索帮助

0d507c66 1850385 C8b1a773 1850385