feat:移植工程
This commit is contained in:
66
vite.config.ts
Normal file
66
vite.config.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
import path from 'path'
|
||||
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
||||
import { viteMockServe } from 'vite-plugin-mock'
|
||||
|
||||
// const API_HOST = '14.103.235.151'
|
||||
const API_HOST = '127.0.0.1'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
vue(),
|
||||
createSvgIconsPlugin({
|
||||
// 指定需要缓存的图标文件夹
|
||||
iconDirs: [path.resolve(process.cwd(), 'src/icons/svg')],
|
||||
// 指定symbolId格式
|
||||
symbolId: 'icon-[dir]-[name]'
|
||||
}),
|
||||
viteMockServe({
|
||||
mockPath: 'src/mock',
|
||||
enable: false
|
||||
})
|
||||
],
|
||||
css: {
|
||||
preprocessorOptions: {
|
||||
scss: {
|
||||
additionalData: '@use "./src/styles/element/index.module.scss" as *;'
|
||||
}
|
||||
}
|
||||
},
|
||||
base: './',
|
||||
resolve: {
|
||||
// 配置路径别名
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, './src')
|
||||
}
|
||||
},
|
||||
server: {
|
||||
port: 5174,
|
||||
// 服务器代理 服务器没有部署Nginx的情况下使用
|
||||
proxy: {
|
||||
'/admin-service': {
|
||||
target: `http://${API_HOST}:8080`,
|
||||
changeOrigin: true,
|
||||
rewrite: (item) => item.replace(/^\/admin-service/, '')
|
||||
},
|
||||
'/home-service': {
|
||||
target: `http://${API_HOST}:8081`,
|
||||
changeOrigin: true,
|
||||
rewrite: (item) => item.replace(/^\/home-service/, '')
|
||||
},
|
||||
'/blog-service': {
|
||||
target: `http://${API_HOST}:8082`,
|
||||
changeOrigin: true,
|
||||
rewrite: (item) => item.replace(/^\/blog-service/, '')
|
||||
},
|
||||
'/hello-service': {
|
||||
target: 'https://www.helloimg.com/api/v1',
|
||||
changeOrigin: true,
|
||||
rewrite: (item) => item.replace(/^\/hello-service/, '')
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user