import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import path from 'path';


export default defineConfig({
  plugins: [vue()],
  server: {
    historyApiFallback: true,  // Fallback para o history mode do Vue Router
    proxy: {
      '/api': {
        target: 'http://127.0.0.1:5000',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      },
      '/new-api': { // Adicionando a nova API
        target: 'http://127.0.0.1:5001',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/new-api/, '')
      },
      fs: {
        allow: [
          // Caminho absoluto para o node_modules no seu caso
          path.resolve(__dirname, 'node_modules')
        ]
      }
    }
  }
});
