build: assets link error

This commit is contained in:
ReaJason
2026-06-28 21:22:31 +08:00
parent 862ad44a0a
commit 7c0ae4b228
3 changed files with 23 additions and 19 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ RUN git clone --depth 1 https://github.com/ReaJason/MemShellParty.git . && \
# https://hub.docker.com/r/oven/bun # https://hub.docker.com/r/oven/bun
FROM --platform=$BUILDPLATFORM oven/bun:1.3.11 AS frontend FROM --platform=$BUILDPLATFORM oven/bun:1.3.11 AS frontend
ARG ROUTE_ROOT_PATH="/" ARG ROUTE_ROOT_PATH=""
ARG CONTEXT_PATH="" ARG CONTEXT_PATH=""
WORKDIR /usr/src/web WORKDIR /usr/src/web
+9 -5
View File
@@ -2,15 +2,18 @@ import { reactRouter } from "@react-router/dev/vite";
import tailwindcss from "@tailwindcss/vite"; import tailwindcss from "@tailwindcss/vite";
import mdx from "fumadocs-mdx/vite"; import mdx from "fumadocs-mdx/vite";
import path from "node:path"; import path from "node:path";
import { env } from "node:process"; import { defineConfig, loadEnv } from "vite";
import { defineConfig } from "vite";
import devtoolsJson from "vite-plugin-devtools-json"; import devtoolsJson from "vite-plugin-devtools-json";
import * as MdxConfig from "./source.config"; import * as MdxConfig from "./source.config";
const isDev = env.NODE_ENV === "development"; export default defineConfig(({ command, mode }) => {
export default defineConfig({ const env = loadEnv(mode, process.cwd(), "VITE_APP_");
base: isDev ? "/" : `${env.VITE_APP_API_URL}/`, const isDev = command === "serve";
const contextPath = env.VITE_APP_API_URL?.trim() ?? "";
return {
base: isDev || !contextPath ? "/" : `${contextPath}/`,
plugins: [mdx(MdxConfig), tailwindcss(), reactRouter(), devtoolsJson()], plugins: [mdx(MdxConfig), tailwindcss(), reactRouter(), devtoolsJson()],
resolve: { resolve: {
tsconfigPaths: true, tsconfigPaths: true,
@@ -23,4 +26,5 @@ export default defineConfig({
: {}), : {}),
}, },
}, },
};
}); });