1 Star 5 Fork 2

瑾轩/vue3Init

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vite.config.ts 3.29 KB
一键复制 编辑 原始数据 按行查看 历史
瑾轩 提交于 2023-03-24 11:15 . 暂存
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import viteCompression from 'vite-plugin-compression'
// 如果编辑器提示 path 模块找不到,则可以安装一下 @types/node -> npm i @types/node -D
import { resolve } from 'path'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
viteCompression({
verbose: true,
disable: false,
threshold: 10240,
algorithm: `gzip`,
ext: `.gz`,
}),
],
// 配置别名
resolve: {
alias: {
'@': resolve(__dirname, `src`),
'@assets': resolve(__dirname, `src/assets`),
'@router': resolve(__dirname, `src/router`),
'@store': resolve(__dirname, `src/store`),
'@components': resolve(__dirname, `src/components`),
'@views': resolve(__dirname, `src/views`),
},
},
// CSS 预处理器
css: {
preprocessorOptions: {
less: {
//https://github.com/vueComponent/ant-design-vue/blob/main/components/style/themes/default.less
//下面列几个常用的 用于复制 用到其他的自己去上面网址找吧
//@error-color @red-5 这俩颜色一样 根据使用场景自行使用
//@warning-color @gold-6 这俩颜色一样 根据使用场景自行使用
//@success-color @green-6 这俩颜色一样 根据使用场景自行使用
//@disabled-color
//@text-color
//@text-color-secondary
//@border-color-base
//@border-color-split
//@font-size-base 14px
//@margin-lg: 24px; // containers
//@margin-md: 16px; // small containers and buttons
//@margin-sm: 12px; // Form controls and items
//@margin-xs: 8px; // small items
//@margin-xss: 4px; // more small
//@padding-lg: 24px; // containers
//@padding-md: 16px; // small containers and buttons
//@padding-sm: 12px; // Form controls and items
//@padding-xs: 8px; // small items
//@padding-xss: 4px; // more small
modifyVars: {
hack: `true; @import (reference) "${resolve(`src/assets/less/index.less`)}";`, //将ant里面所有的变量引进来
// 'primary-color': `#0f608a`,
// 'border-radius-base': `4px`,
// 'modal-header-padding': `@padding-sm`,
// 'modal-body-padding': `@padding-sm`,
// 'modal-header-close-size': `48px`,
// 'modal-footer-padding-horizontal': `@padding-sm`,
//非ant样式变量
'scrollbar-size': `8px`,
'scrollbar-background': `#00000080`,
'scrollbar-track-background': `transparent`,
},
javascriptEnabled: true,
},
},
},
base: `./`, // 设置打包路径
//启动服务配置
server: {
host: `0.0.0.0`,
port: 8000,
open: true, // 设置服务启动时是否自动打开浏览器
cors: true, // 允许跨域
https: false,
// 设置代理,根据我们项目实际情况配置
// proxy: {
// '/api': {
// target: 'http://xxx.xxx.xxx.xxx:8000',
// changeOrigin: true,
// secure: false,
// rewrite: (path) => path.replace('/api/', '/')
// }
// }
},
//去除 console debugger
build: {
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true,
},
},
},
})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/feng78/vue3Init.git
git@gitee.com:feng78/vue3Init.git
feng78
vue3Init
vue3Init
master

搜索帮助