diff options
Diffstat (limited to 'frontend/vite.config.ts')
| -rw-r--r-- | frontend/vite.config.ts | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index aa41236..c90383c 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts | |||
| @@ -1,32 +1,38 @@ | |||
| 1 | import { defineConfig } from 'vite' | 1 | import { defineConfig, loadEnv } from 'vite' |
| 2 | import react from '@vitejs/plugin-react' | 2 | import react from '@vitejs/plugin-react' |
| 3 | import tailwindcss from '@tailwindcss/vite' | 3 | import tailwindcss from '@tailwindcss/vite' |
| 4 | import path from 'path' | 4 | import path from 'path' |
| 5 | 5 | ||
| 6 | export default defineConfig({ | 6 | export default defineConfig(({ mode }) => { |
| 7 | plugins: [react(), tailwindcss()], | 7 | // load env variables for the current mode (from .env, .env.development, etc.) |
| 8 | resolve: { | 8 | const env = loadEnv(mode, process.cwd(), '') |
| 9 | alias: { | 9 | const API_TARGET = env.VITE_API_TARGET || 'https://lp.pektezol.dev/' |
| 10 | '@api': path.resolve(__dirname, './src/api'), | 10 | |
| 11 | '@components': path.resolve(__dirname, './src/components'), | 11 | return { |
| 12 | '@css': path.resolve(__dirname, './src/css'), | 12 | plugins: [react(), tailwindcss()], |
| 13 | '@customTypes': path.resolve(__dirname, './src/types'), | 13 | resolve: { |
| 14 | '@hooks': path.resolve(__dirname, './src/hooks'), | 14 | alias: { |
| 15 | '@pages': path.resolve(__dirname, './src/pages'), | 15 | '@api': path.resolve(__dirname, './src/api'), |
| 16 | '@utils': path.resolve(__dirname, './src/utils'), | 16 | '@components': path.resolve(__dirname, './src/components'), |
| 17 | '@images': path.resolve(__dirname, './src/images'), | 17 | '@css': path.resolve(__dirname, './src/css'), |
| 18 | '@customTypes': path.resolve(__dirname, './src/types'), | ||
| 19 | '@hooks': path.resolve(__dirname, './src/hooks'), | ||
| 20 | '@pages': path.resolve(__dirname, './src/pages'), | ||
| 21 | '@utils': path.resolve(__dirname, './src/utils'), | ||
| 22 | '@images': path.resolve(__dirname, './src/images'), | ||
| 23 | }, | ||
| 18 | }, | 24 | }, |
| 19 | }, | 25 | server: { |
| 20 | server: { | 26 | port: 3000, |
| 21 | port: 3000, | 27 | proxy: { |
| 22 | proxy: { | 28 | '/api': { |
| 23 | '/api': { | 29 | target: API_TARGET, |
| 24 | target: 'https://lp.pektezol.dev/', | 30 | changeOrigin: true, |
| 25 | changeOrigin: true, | 31 | }, |
| 26 | }, | 32 | }, |
| 27 | }, | 33 | }, |
| 28 | }, | 34 | build: { |
| 29 | build: { | 35 | outDir: 'build', |
| 30 | outDir: 'build', | 36 | }, |
| 31 | }, | 37 | } |
| 32 | }) \ No newline at end of file | 38 | }) \ No newline at end of file |