1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- import {fileURLToPath, URL} from 'node:url'
- import {defineConfig} from 'vite'
- import vue from '@vitejs/plugin-vue'
- import vueJsx from '@vitejs/plugin-vue-jsx'
- import vueDevTools from 'vite-plugin-vue-devtools'
- import svgicon from 'vite-plugin-svgicon'
- import * as path from 'path'
- // https://vite.dev/config/
- export default defineConfig({
- define: {
- 'process.env': {
- 'BASE_API': '/base_api'
- },
- },
- // 配置前端服务地址和端口
- server: {
- host: '0.0.0.0',
- port: 80,
- // 设置反向代理,跨域
- proxy: {
- '/tbazmw_api': {
- // 后台地址
- target: 'http://10.8.48.234:8081/',
- changeOrigin: true,
- rewrite: path => path.replace(/^\/tbazmw_api/, '')
- },
- '/gx_api': {
- // 共享平台
- target: 'http://10.8.4.136:8881/api/sz/tba-gx/',
- changeOrigin: true,
- rewrite: path => path.replace(/^\/gx_api/, '')
- },
- '/gx_gj_api': {
- // 共享平台
- target: 'http://10.8.4.136:8881/api/sq_zh/',
- changeOrigin: true,
- rewrite: path => path.replace(/^\/gx_gj_api/, '')
- },
- '/nmc_api': {
- // 共享平台
- target: 'http://www.nmc.cn/',
- changeOrigin: true,
- rewrite: path => path.replace(/^\/nmc_api/, '')
- },
- '/video_api': {
- // 地听视频
- target: 'http://10.8.48.234:8081/',
- changeOrigin: true,
- rewrite: path => path.replace(/^\/video_api/, '')
- },
- }
- },
- plugins: [
- vue(),
- vueJsx(),
- vueDevTools(),
- svgicon({
- include: ['**/assets/svg/*.svg'],
- svgFilePath: path.join(__dirname, 'src/assets/svg'),
- }),
- ],
- resolve: {
- alias: {
- '@': fileURLToPath(new URL('./src', import.meta.url))
- }
- },
- css: {
- preprocessorOptions: {
- scss: {
- api: "modern-compiler", // or 'modern'
- // 自动导入定制化样式文件进行样式覆盖
- // additionalData: `
- // @use "@/assets/styles/element/index.scss";
- // `,
- }
- }
- },
- })
|