10 Star 162 Fork 50

howcode/AQChat

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
vite.config.js 1.80 KB
一键复制 编辑 原始数据 按行查看 历史
/*
* @Author: howcode 1051495009@qq.com
* @Date: 2024-04-20 18:08:20
* @LastEditors: howcode 1051495009@qq.com
* @LastEditTime: 2024-06-14 22:17:19
* @Description:
*/
import { defineConfig } from 'vite'
import path from "path";
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
// 时间戳
const timestamp = new Date().getTime();
export default defineConfig({
base: "./",
root: process.cwd(),
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"), // 路径别名
},
extensions: [".js", ".json", ".ts"], // 使用路径别名时想要省略的后缀名,可以自己 增减
},
assetsInclude: ["./src/assets"],
plugins: [vue()],
build: {
rollupOptions: {
output: {
chunkFileNames: ({ name }) => {
if (name === 'vendor') {
return `assets/js/[name]-[hash].js`; // 第三方库不添加时间戳
} else {
return `assets/js/[name]-[hash]-${timestamp}.js`; // 自定义文件名,使用时间戳保证唯一性
}
},
entryFileNames: ({ name }) => {
if (name === 'vendor') {
return `assets/js/[name]-[hash].js`; // 第三方库不添加时间戳
} else {
return `assets/js/[name]-[hash]-${timestamp}.js`; // 自定义文件名,使用时间戳保证唯一性
}
},
assetFileNames: `assets/[ext]/[name]-[hash]-${timestamp}.[ext]` // 资源文件添加时间戳
},
},
},
css: {
preprocessorOptions: {
scss: {
additionalData: `@import "@/assets/style/common.less";`,
},
less: {
javascriptEnabled: true,
modifyVars: {
hack: `true; @import (reference) "${path.resolve(
"src/assets/style/variables.less"
)}";`,
},
},
},
},
})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/howcode/aq-chat.git
git@gitee.com:howcode/aq-chat.git
howcode
aq-chat
AQChat
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891