CRA-Helper/artifacts/cra-app/vite.config.ts
sylvain p 071a8aa3ac Drop attached_assets folder
Removes 7 unused PNGs (Replit-generated screenshots) plus the matching
@assets Vite alias and the docker/web.Dockerfile copy step. Nothing
in the source code imported from this alias.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 12:43:33 +02:00

57 lines
1.1 KiB
TypeScript

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";
import path from "path";
const rawPort = process.env.PORT;
if (!rawPort) {
throw new Error(
"PORT environment variable is required but was not provided.",
);
}
const port = Number(rawPort);
if (Number.isNaN(port) || port <= 0) {
throw new Error(`Invalid PORT value: "${rawPort}"`);
}
const basePath = process.env.BASE_PATH;
if (!basePath) {
throw new Error(
"BASE_PATH environment variable is required but was not provided.",
);
}
export default defineConfig({
base: basePath,
plugins: [react(), tailwindcss()],
resolve: {
alias: {
"@": path.resolve(import.meta.dirname, "src"),
},
dedupe: ["react", "react-dom"],
},
root: path.resolve(import.meta.dirname),
build: {
outDir: path.resolve(import.meta.dirname, "dist/public"),
emptyOutDir: true,
},
server: {
port,
host: "0.0.0.0",
allowedHosts: true,
fs: {
strict: true,
deny: ["**/.*"],
},
},
preview: {
port,
host: "0.0.0.0",
allowedHosts: true,
},
});