vite.config.ts 678 B

1234567891011121314151617181920212223
  1. import react from "@vitejs/plugin-react";
  2. import { defineConfig, loadEnv } from "vite";
  3. // https://vitejs.dev/config/
  4. export default defineConfig(({ mode }) => {
  5. // Load env file based on `mode` in the current directory.
  6. // Set the third parameter to '' to load all env regardless of the `VITE_` prefix.
  7. const env = loadEnv(mode, process.cwd(), '');
  8. return {
  9. plugins: [react()],
  10. // Make Vite aware of the env variables
  11. define: {
  12. 'process.env': env
  13. },
  14. // Enable CORS for development
  15. server: {
  16. cors: true,
  17. port: env.PORT ? Number(env.PORT) : 3000,
  18. allowedHosts: ['.localhost', 'lboulet.vm.vdi.s1.p.fti.net']
  19. }
  20. }
  21. });