zhxy-jzd/vite.config.ts
ywyonui 5fef0a1855 1、修复静态资源文件加载失败的问题
2、添加抢课成功补选的功能
2025-09-04 23:01:58 +08:00

64 lines
2.2 KiB
TypeScript

import {defineConfig} from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import {resolve} from 'path'
import autdPlugin from './plugin/vite-plugin-autd'
import AutoImport from 'unplugin-auto-import/vite'
import AutoStylePlugin from "./plugin/vite-plugin-autoStyle";
import {HOMEAGENT} from "./src/config";
export default defineConfig({
server: {
proxy: {
"/base": {
target: HOMEAGENT,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/base/, ""),
},
},
port: 5139,
},
plugins: [
//c 为class 例如 class="wi-10"
//w 为样式style 例如 width:10rpx
//t 为值开头 例如 color:#000
//w 为值结尾 例如 width:10rpx
AutoStylePlugin([
{c: 'wi', s: 'width', t: '', w: 'rpx'},
{c: 'he', s: 'height', t: '', w: 'rpx'},
{c: 'cor', s: 'color', t: '#', w: ''},
{c: 'back', s: 'background', t: '#', w: ''},
{c: 'bor', s: 'border', t: '1px solid #', w: ''},
{c: 'gridCols', s: 'grid-template-columns', t: 'repeat(', w: ', minmax(0, 1fr))'},
{c: 'gridRows', s: 'grid-template-rows', t: 'repeat(', w: ', minmax(0, 1fr))'},
{c: 'gapY', s: 'grid-row-gap', t: '', w: 'rpx'},
{c: 'gapX', s: 'grid-column-gap', t: '', w: 'rpx'},
{c: 'colSpan', s: 'grid-column', t: 'span ', w: ''},
{c: 'rowSpan', s: 'grid-row', t: 'span ', w: ''},
]),
autdPlugin(),
uni({
vueOptions: {
template: {
compilerOptions: {
isCustomElement: tag => tag.startsWith("amap")
}
}
}
}),
AutoImport({
include: [
/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
/\.vue$/, /\.vue\?vue/ // .vue
],
imports: ['vue', 'pinia'],
dts: "src/auto-import.d.ts" // 生成在src路径下名为auto-import.d.ts的声明文件
}),
],
resolve: {
alias: {
'@': resolve(__dirname, './src'),
'#': resolve(__dirname, './types')
}
}
});