| import { defineConfig } from 'vite' |
| import react from '@vitejs/plugin-react' |
| import path from 'path' |
|
|
| |
| export default defineConfig({ |
| plugins: [react({ |
| jsx: 'transform', |
| jsxFactory: 'React.createElement', |
| jsxFragment: 'React.Fragment', |
| })], |
| resolve: { |
| alias: { |
| '@': path.resolve(__dirname, './src'), |
| }, |
| }, |
| server: { |
| port: 3000, |
| host: true, |
| proxy: { |
| '/api': { |
| target: 'http://localhost:5000', |
| changeOrigin: true, |
| secure: false, |
| |
| ws: true, |
| |
| configure: (proxy, _options) => { |
| proxy.on('error', (err, _req, _res) => { |
| console.log('proxy error', err); |
| }); |
| proxy.on('proxyReq', (proxyReq, req, _res) => { |
| console.log('Sending Request to the Target:', req.method, req.url); |
| }); |
| proxy.on('proxyRes', (proxyRes, req, _res) => { |
| console.log('Received Response from the Target:', proxyRes.statusCode, req.url); |
| }); |
| }, |
| }, |
| |
| '/ws': { |
| target: 'http://localhost:5000', |
| ws: true, |
| changeOrigin: true, |
| secure: false, |
| }, |
| }, |
| }, |
| build: { |
| outDir: 'dist', |
| sourcemap: true, |
| |
| rollupOptions: { |
| output: { |
| manualChunks: { |
| |
| vendor: ['react', 'react-dom', 'react-router-dom', 'react-redux'], |
| }, |
| }, |
| }, |
| |
| commonjsOptions: { |
| include: [/node_modules/], |
| }, |
| }, |
| |
| define: { |
| 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'), |
| }, |
| }) |