代码拉取完成,页面将自动刷新
import { defineConfig } from 'vite'
import vueJsx from '@vitejs/plugin-vue-jsx'
import vue from '@vitejs/plugin-vue'
import * as path from 'path'
import { resolve } from 'path'
// 实现 组件的按需加载
// 当引入 "unplugin-vue-components/vite 组件之后,页面中需要引入组件的地方就都不需要引入了
//import Components from "unplugin-vue-components/vite";
//import {
// ViewUIResolver
//} from "unplugin-vue-components/resolvers";
// // 实现 Vue及Vue相关的库、api的 按需加载
import AutoImport from "unplugin-auto-import/vite";
// https://vitejs.dev/config/
export default defineConfig({
base: '/competition-front/',
plugins: [vue({
reactivityTransform: true, //ref配置为$ref
}),
vueJsx({
// include: ["**/*.vue"]
// options are passed on to @vue/babel-plugin-jsx
}),
// ant自动引入组件配置后会引起ant主题定制出错
//Components({
// resolvers: [
// ViewUIResolver()
// ]
//}),
AutoImport({
// include: [
// // /\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
// /\.vue$/, /\.vue\?vue/, // .vue
// ],
imports: ["vue", "vue-router", "pinia"],
})
],
resolve: {
//设置别名
alias: [
{
find: "@",
replacement: path.resolve(__dirname, "src"),
},
{
find: "common",
replacement: path.resolve(__dirname, "src/common"),
},
{
find: "components",
replacement: path.resolve(__dirname, "src/components"),
},
]
},
css: {
preprocessorOptions: {
less: {
modifyVars: {
// 用于全局导入,以避免需要单独导入每个样式文件。
// reference: 避免重复引用
hack: `true; @import (reference) "${resolve("src/style/variable.less")}"; `,
},
// 使用javascript能力定制主题
// 设置为true后可以定制化主题,在main.js中引入'ant-design-vue/dist/antd.less'文件进行编译
// 这个项目UI库可能用到 iview 而不是 ant
javascriptEnabled: true,
}
}
},
// 打包配置
build: {
minify: 'terser',
terserOptions: {
compress: {
//生产环境时移除console
drop_console: true,
drop_debugger: true,
},
},
},
server: {
host: '0.0.0.0',
port: 2200
// proxy: 'http://192.168.3.221:80'
// proxy: 'https://g.aomao.com/latex'
}
})
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。