63 lines
1.7 KiB
JavaScript
63 lines
1.7 KiB
JavaScript
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import dotenv from 'dotenv';
|
|
|
|
console.log('process.env:', process.env);
|
|
console.log('TEst:', process.env.VITE_API_BASE_URL);
|
|
// Load environment variables based on the environment mode
|
|
dotenv.config({
|
|
path: `.env.${process.env.NODE_ENV || 'development'}`
|
|
});
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
vue(),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
}
|
|
},
|
|
|
|
server: {
|
|
proxy: {
|
|
'/login/rss': {
|
|
target: `${process.env.VITE_API_BASE_URL}/api/v1/auth/login`,
|
|
changeOrigin: true,
|
|
secure: false,
|
|
rewrite: (path) => path.replace(/^\/login\/rss/, ''),
|
|
},
|
|
'/feeds/get': {
|
|
target: `${process.env.VITE_API_BASE_URL}/api/v1/article/get`,
|
|
changeOrigin: true,
|
|
secure: false,
|
|
rewrite: (path) => path.replace(/^\/feeds\/get/, ''),
|
|
},
|
|
'/feeds/sync': {
|
|
target: `${process.env.VITE_API_BASE_URL}/api/v1/article/sync`,
|
|
changeOrigin: true,
|
|
secure: false,
|
|
rewrite: (path) => path.replace(/^\/feeds\/sync/, ''),
|
|
},
|
|
'/feeds/read': {
|
|
target: `${process.env.VITE_API_BASE_URL}/api/v1/article/read`,
|
|
changeOrigin: true,
|
|
secure: false,
|
|
rewrite: (path) => path.replace(/^\/feeds\/read/, ''),
|
|
},
|
|
'/feeds/add': {
|
|
target: `${process.env.VITE_API_BASE_URL}/api/v1/article/add`,
|
|
changeOrigin: true,
|
|
secure: false,
|
|
rewrite: (path) => path.replace(/^\/feeds\/add/, ''),
|
|
},
|
|
},
|
|
|
|
cors: false
|
|
},
|
|
|
|
})
|