feat(deploy): configurable backend HOST + env-driven vite base/assetsDir
- backend: HOST env (default 127.0.0.1, dev-safe; 0.0.0.0 in container) - frontend: VITE_BASE drives base/assetsDir/manifest for portal embedding - backward compatible: no env => identical to previous behavior
This commit is contained in:
+11
-7
@@ -2,11 +2,15 @@ import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import path from "path";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": path.resolve(__dirname, "./src"),
|
||||
},
|
||||
},
|
||||
export default defineConfig(() => {
|
||||
const embedBase = process.env.VITE_BASE; // "/datamart-builder/assets/" in embedded; undefined = standalone
|
||||
return {
|
||||
plugins: [react()],
|
||||
// base: prefisso pubblico degli asset. Default "/" (standalone).
|
||||
// assetsDir vuoto in embedded → asset alla root di dist/ così il proxy
|
||||
// /datamart-builder/assets/ → frontend-root mappa 1:1 (niente /assets/assets/).
|
||||
base: embedBase ?? "/",
|
||||
build: { manifest: true, outDir: "dist", assetsDir: embedBase ? "" : "assets" },
|
||||
resolve: { alias: { "@": path.resolve(__dirname, "./src") } },
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user