83 lines
2.3 KiB
TypeScript
83 lines
2.3 KiB
TypeScript
import { defineConfig, ConfigEnv, loadEnv, UserConfig } from 'vite'
|
|||
|
|
|
||
|
|
import vue from '@vitejs/plugin-vue'
|
||
|
|
import { resolve } from "path";
|
||
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
||
|
|
import Components from 'unplugin-vue-components/vite'
|
||
|
|
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
||
|
|
import { createStyleImportPlugin, VxeTableResolve } from 'vite-plugin-style-import'
|
||
|
|
|
||
|
|
const pathSrc = resolve(__dirname, "./src")
|
||
|
|
|
||
|
|
// https://vitejs.dev/config/
|
||
|
|
export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
|
||
|
|
const env = loadEnv(mode, process.cwd());
|
||
|
|
|
||
|
|
return {
|
||
|
|
base: "./",
|
||
|
|
build: {
|
||
|
|
emptyOutDir: true, //清空输出路径
|
||
|
|
//编译后输出路径
|
||
|
|
outDir: 'F:\\Eclipse\\workspaceText\\abacus.cloud.oauth2.acas\\src\\main\\resources\\html\\vue\\sms'
|
||
|
|
},
|
||
|
|
resolve: {
|
||
|
|
alias: {
|
||
|
|
'@': pathSrc,
|
||
|
|
},
|
||
|
|
},
|
||
|
|
server: {
|
||
|
|
host: "0.0.0.0",
|
||
|
|
port: 3000,
|
||
|
|
open: false,
|
||
|
|
// 反向代理解决跨域
|
||
|
|
proxy: {
|
||
|
|
'/temp': {
|
||
|
|
target: "http://localhost/",
|
||
|
|
changeOrigin: true,//是否跨域
|
||
|
|
},
|
||
|
|
'/sms/': {
|
||
|
|
target: "http://localhost/",
|
||
|
|
changeOrigin: true,//是否跨域
|
||
|
|
//rewrite: (path) => path.replace(/^\/sms/, '/acas'),
|
||
|
|
},
|
||
|
|
'/pay/': {
|
||
|
|
target: "http://192.9.200.161:9060/",
|
||
|
|
changeOrigin: true,//是否跨域
|
||
|
|
//rewrite: (path) => path.replace(/^\/sms/, '/acas'),
|
||
|
|
},
|
||
|
|
'/frameconfig': {
|
||
|
|
target: "http://localhost/",
|
||
|
|
changeOrigin: true,//是否跨域
|
||
|
|
},
|
||
|
|
},
|
||
|
|
},
|
||
|
|
plugins: [
|
||
|
|
vue(),
|
||
|
|
AutoImport({
|
||
|
|
// 自动导入 Vue 相关函数,如:ref, reactive, toRef 等
|
||
|
|
imports: ["vue", 'vue-router', "@vueuse/core"],
|
||
|
|
dts: 'src/auto-import.d.ts',
|
||
|
|
resolvers: [ElementPlusResolver()],
|
||
|
|
}),
|
||
|
|
Components({
|
||
|
|
resolvers: [ElementPlusResolver()],
|
||
|
|
}),
|
||
|
|
createStyleImportPlugin({
|
||
|
|
resolves: [
|
||
|
|
VxeTableResolve()
|
||
|
|
],
|
||
|
|
}),
|
||
|
|
],
|
||
|
|
css: {
|
||
|
|
// CSS 预处理器
|
||
|
|
preprocessorOptions: {
|
||
|
|
//define global scss variable
|
||
|
|
scss: {
|
||
|
|
//javascriptEnabled: true, //更新vite6后报错,注释
|
||
|
|
additionalData: `@use "@/framework/styles/variables.scss" as *;`
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
}
|
||
|
|
})
|