import react from '@vitejs/plugin-react' import path, { dirname } from 'path' import { fileURLToPath } from 'url' import { defineConfig, loadEnv } from 'vite' const _dirname = dirname(fileURLToPath(import.meta.url)) // https://vitejs.dev/config/ export default defineConfig(({ mode }) => { // eslint-disable-next-line no-undef const env = loadEnv(mode, process.cwd(), '') // production if (env.NODE_ENV === 'production') { return { resolve: { alias: { '@': path.resolve(_dirname, './src'), '@lang': path.resolve(_dirname, './src/lang'), '@api': path.resolve(_dirname, './src/api'), '@hooks': path.resolve(_dirname, './src/hooks'), '@pages': path.resolve(_dirname, './src/pages'), '@components': path.resolve(_dirname, './src/components'), '@routes': path.resolve(_dirname, './src/routes'), '@utils': path.resolve(_dirname, './src/utils'), '@assets': path.resolve(_dirname, './src/assets'), '@context': path.resolve(_dirname, './src/context'), }, }, plugins: [react()], css: { preprocessorOptions: { scss: { additionalData: '@import "./src/_mantine";', }, }, }, server: { https: false, host: false, port: 5001, strictPort: true, watch: { usePolling: true, }, }, } } return { resolve: { alias: { '@': path.resolve(_dirname, './src'), '@lang': path.resolve(_dirname, './src/lang'), '@api': path.resolve(_dirname, './src/api'), '@hooks': path.resolve(_dirname, './src/hooks'), '@pages': path.resolve(_dirname, './src/pages'), '@components': path.resolve(_dirname, './src/components'), '@routes': path.resolve(_dirname, './src/routes'), '@utils': path.resolve(_dirname, './src/utils'), '@assets': path.resolve(_dirname, './src/assets'), '@context': path.resolve(_dirname, './src/context'), }, }, plugins: [react()], css: { preprocessorOptions: { scss: { additionalData: '@import "./src/_mantine";', }, }, }, server: { https: false, host: true, port: 5001, strictPort: true, watch: { usePolling: true, }, proxy: { '/api': 'http://localhost:9000', }, }, } })