2024-03-29 20:08:34 -04:00
|
|
|
import { defineConfig } from 'vite';
|
|
|
|
|
import react from '@vitejs/plugin-react-swc';
|
|
|
|
|
import pluginChecker from 'vite-plugin-checker';
|
2024-09-14 18:08:18 -04:00
|
|
|
import EnvironmentPlugin from 'vite-plugin-environment';
|
2024-03-29 20:08:34 -04:00
|
|
|
|
2025-01-29 11:35:45 -05:00
|
|
|
console.log("⚡ Vite config is being loaded!");
|
|
|
|
|
|
2024-10-30 22:04:48 -04:00
|
|
|
// Filter out environment variables with invalid identifiers
|
|
|
|
|
const filteredEnv = Object.keys(process.env).reduce((acc, key) => {
|
|
|
|
|
// Only include environment variables with valid JavaScript identifiers
|
|
|
|
|
if (/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(key)) {
|
|
|
|
|
acc[key] = process.env[key];
|
|
|
|
|
}
|
|
|
|
|
return acc;
|
|
|
|
|
}, {});
|
|
|
|
|
|
2024-03-29 20:08:34 -04:00
|
|
|
// https://vitejs.dev/config/
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
base: "/",
|
|
|
|
|
plugins: [
|
|
|
|
|
react(),
|
|
|
|
|
pluginChecker({ typescript: true }),
|
2024-10-30 22:04:48 -04:00
|
|
|
EnvironmentPlugin(filteredEnv),
|
2024-03-29 20:08:34 -04:00
|
|
|
],
|
2025-01-10 15:56:43 -05:00
|
|
|
resolve: {
|
|
|
|
|
alias: {
|
|
|
|
|
'src': '/src'
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-03-29 20:08:34 -04:00
|
|
|
preview: {
|
|
|
|
|
port: 5173,
|
2025-01-29 11:35:45 -05:00
|
|
|
strictPort: true,
|
|
|
|
|
allowedHosts: ['frontend', 'localhost'],
|
2024-03-29 20:08:34 -04:00
|
|
|
},
|
|
|
|
|
server: {
|
2024-10-30 22:04:48 -04:00
|
|
|
port: 5173,
|
|
|
|
|
strictPort: true,
|
|
|
|
|
host: true,
|
|
|
|
|
origin: "http://0.0.0.0:5173",
|
2025-01-29 11:35:45 -05:00
|
|
|
allowedHosts: ['frontend', 'localhost'],
|
2024-03-29 20:08:34 -04:00
|
|
|
},
|
2024-10-30 21:40:35 -04:00
|
|
|
build: {
|
|
|
|
|
sourcemap: true, // Enable source maps
|
2024-10-30 22:04:48 -04:00
|
|
|
rollupOptions: {
|
|
|
|
|
output: {
|
|
|
|
|
sourcemapExcludeSources: true, // Exclude sources from source maps
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-10-30 21:40:35 -04:00
|
|
|
},
|
2024-03-29 20:08:34 -04:00
|
|
|
});
|